Skip to content

LemonBoy/chicken-sndfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chicken-sndfile

🐔 CHICKEN wrapper for libsndfile

API

The whole API consists of two functions: with-sound-from-file and with-sound-to-file.

with-sound-from-file

(with-sound-from-file file thunk) 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

(with-sound-to-file file format samplerate channels thunk) 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,s8,s16,s32,f32,f64}

(read-items!/FMT handle buffer [n]) 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,s8,s16,s32,f32,f64}

(write-items/FMT handle buffer [n]) 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 holds enough data. Note that n is optional, by omitting it the library assumes you want to write out the whole buffer.

About

CHICKEN wrapper for libsndfile

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages