Soundscrape uses the libsndfile library to perform input and output to files, which allows it quite a range of supported audio formats.
disk-inInput from sound files on disk is accomplished with the disk-in unit generator, which only operates at audio rate. Calling audio on this class will return a list of as many channels as the sound file contains.
;; Render a drum beat
(render (audio syndrum ;; look up syndrum in the help
:trigger (control random-osc 2) ;; same with random-osc
:velocity 1.0
:frequency 200
:resonance 0.1)
5
"my-sound-file.wav")
;; now play the file
(play (audio disk-in "my-sound-file.wav"))
;; we can even delete it from scheme -- dangerous but useful
(delete-file "my-sound-file.wav")
;; audio for disk-in has two extra optional arguments, loop? and
;; start-frame. both are accepted but have no effect on input, as they
;; are not implemented yet.For the moment, render and record are the only ways to write to disk. However, as it is sometimes useful to have more control over the process, a disk-out unit generator will appear sometime in the future.
The last two arguments to render and record specify the type of file to create. The first specifies the major type, and can be set with the keyword :type. Possible values for :type include the following:
aiffApple/SGI
auSun/NeXT
iffAmiga IFF/SVX8/SV16
matGNU Octave 2.0 / Matlab 4.2
mat-MAT5--GNU-Octave-2-1---Matlab-5-0-GNU Octave 2.1 / Matlab 5.0
pafEnsoniq PARIS
pvfPortable Voice Format
rawheader-less file
sfBerkeley/IRCAM/CARL
vocCreative Labs
w64SoundFoundry WAVE 64
wavMicrosoft
wav-WAV--NIST-Sphere-NIST Sphere
xiFastTracker 2
The second of the two type arguments specifies the minor type, accesible via the :format keyword. Not all of the major-minor combinations are supported; see the sndfile page, listed in the references, for more information. Possible values for the minor type are self-explanatory, and are listed in the following table:
signed-8-bit-pcm
signed-16-bit-pcm
signed-24-bit-pcm
signed-32-bit-pcm
unsigned-8-bit-pcm
32-bit-float
64-bit-float
u-law
a-law
ima-adpcm
microsoft-adpcm
gsm-6-10
32kbs-g721-adpcm
24kbs-g723-adpcm
12-bit-dwvw
16-bit-dwvw
24-bit-dwvw
vox-adpcm
16-bit-dpcm
8-bit-dpcm
The exact set of major and minor types may change as libsndfile develops. According to the web page, its author is currently planning to implement support for Soundfont II, Gravis Ultrasound, Kurtzweil K2000, Ogg Vorbis, and FLAC files.