chickadee » sndfile

sndfile

Documentation

Wrapper for the sndfile library providing a simple and easy to use API.

API

with-sound-from-file file thunkprocedure

Opens the file named by file for reading (the format is autodetected) and then executes thunk which is a procedure accepting five arguments:

  • handle: an opaque pointer to the underlying sndfile object
  • format: a three-element list containing the format, the subformat and the endianness of the file
  • samplerate: the sample rate of the file
  • channels: the number of channels of the file
  • frames: the number of audio frames
with-sound-to-file file format samplerate channels thunkprocedure

Opens the file named by file for writing using the specified parameters. Please refer to the previous section for more informations about the format of the parameters. The procedure thunk is then executed with a single argument handle.

read-items!/u8 handle buffer #!optional nprocedure
read-items!/s8 handle buffer #!optional nprocedure
read-items!/s16 handle buffer #!optional nprocedure
read-items!/s32 handle buffer #!optional nprocedure
read-items!/f32 handle buffer #!optional nprocedure
read-items!/f64 handle buffer #!optional nprocedure

Reads n items from the open file handle in buffer and returns the number of items read. The procedure is safe and it makes sure you're using the right kind of srfi-4 vector and that it is big enough to hold the data. Note that n is optional, by omitting it the library assumes you want to read enough data to fill the whole buffer.

write-items/u8 handle buffer #!optional nprocedure
write-items/s8 handle buffer #!optional nprocedure
write-items/s16 handle buffer #!optional nprocedure
write-items/s32 handle buffer #!optional nprocedure
write-items/f32 handle buffer #!optional nprocedure
write-items/f64 handle buffer #!optional nprocedure

Writes n items to the open file handle from buffer and returns the number of items written. The procedure is safe and it makes sure you're using the right kind of srfi-4 vector and that it holds enough data. Note that n is optional, by omitting it the library assumes you want to write out the whole buffer.

Author

LemonBoy

Repository

Github

Contents »