8.2.1.0. simple-audio: reading, writing, and playing sounds
(packages/audio/simple-audio.lsh)


This is a set of simple functions to read, write and play audio samples. These functions use the "sox" command to convert sound files into something Lush can understand. Therefore, all audio file formats supported by sox are supported. This includes ogg, mp3 wav, and such.

8.2.1.0.0. (read-sound f r)
(packages/audio/simple-audio.lsh)


read a sound file and return a vector of doubles with the samples (using a pipe through sox). f is the audio file to read from, and r is the sampling rate to which the sound will be converted before being read (e.g. 10000 for 10KHz sampling rate).

8.2.1.0.1. (write-sound m f r)
(packages/audio/simple-audio.lsh)


write a signal in vector m into a sound file f at sampling rate r . The samples are written as shorts, so they should be between -32768 and 32767.

8.2.1.0.2. (play-sound m r)
(packages/audio/simple-audio.lsh)


play the signal in vector m using sampling rate r .

8.2.1.0.3. (read-sound-raw f)
(packages/audio/simple-audio.lsh)


read a "raw" sound file from file f . This function simply reads a file with a bunch of shorts into a matrix of doubles.