Save AIFF Sound File
Description
Saves a synthesized sound to the standard cross-platform AIFF (Audio Interchange File Format) file. (AIFF-C to be precise.)
(save-aiff ... )
Syntax and Default Values
The (save-aiff ... ) function can be created using the following Lisp syntax:
(save-aiff filename)
Parameters
The (save-aiff ... ) function takes one argument:
- filename: pathname of sound file to be saved. (in quotes.)
The pathname of the soundfile should be provided in quotes. The path is relative to the Modalys application, unless it begins with a slash, in which case it is an absolute path from the root directory of the hard disk. The syntax for the path follows the syntax rules of your operating system. [At one time Modalys had a user-settable soundfile directory that was used as the default directory.]
The sampling rate and bit depth of the sound file will depend on that set in the Modalys workspace for the synthesis.
Discussion
For individual sounds, it is usually easier to choose the "Save Sound as AIFF..." option from the application's Script menu. Nonetheless, it is very useful to be able to automatically save sound files from within a script, such as in cases where the sound synthesis is run multiple times with different parameters in a loop.
When saving from a script, remember that the name of the soundfile should be in quotes. The following command will save the synthesis to an aiff file in the same directory as the Modalys application:
(save-aiff "mysound.aiff")
(save-aiff "/my-disk/my-folder/mysound.aiff")
(defvar counter)
(setq counter 0)
. . .
(setq counter (+ 1 counter))
(save-aiff (format NIL "mysound-~S.aiff" counter))
Note that the number of channels in the AIFF file will the same as the number of output channels. Although Modalys can handle multichannel AIFF files, not all audio software is able to do so! You may have to manually split multichannel files into individual mono files using your favorite audio editing application.
The sample rate of the fill will be the same as the sample rate set in the Modalys environment using (set-sample-rate ... ). By default this is 44100 Hz.
Modalys also saves the AIFF file with the bit depth set in the Modalys environment using (set-bit-depth ... ). By default this is set to 24-bit samples. You can currently choose either 16, 24 or 32 bit integer samples, for compatibility with the standard AIFF-C options. Again, sound files may need to be converted for use with some audio editing software applications.
Options
Retro-Compatibility
Formerly this function was called (save ... ). Old scripts should be updated to the new syntax.