There exist a number of functions allowing to manipulate sound and audio data. A number of them are based on the underlying LibAudioStream library functionalities.
The LibAudioStream library used by OM manipulates sound resources under the form of "
can be seen as abstact pointers representing a sound and possible transformations. In OM the LibAudioStream streams are embedded in a structure called
The SOUND-MIX function creates a SOUND-DATA pointer corresponding to the mix of two sounds.
pointers can eventually be rendered and converted back to sound file using the SAVE-SOUND function.
SOUND-SAVE saves the result of SOUND-MIX into a new sound file. The new file is loaded in a SOUND box.
Below are listed the available sound processing functions. They all produce
SOUND-MIX : mixes two input sounds
SOUND-SEQ : concatenates two input sounds
SOUND-VOL : modifies the volume of an input sound
SOUND-CUT: extracts a specified interval out of an inpt sound
SOUND-FADE : adds a fade-in / fade-out effect to an input sound
SOUND-LOOP : repeats an input sound a number of times
SOUND-SILENCE : generates and empty (silent) sound of a given duration.
See the individual box documentation (press d) for more detailed descriptions.
The sound processing tools can also apply directly on SOUND-DATA pointers. It is therefore possible to apply sequences and combinations of effects and processes without using intermediary files.
SAVE-SOUND can be used eventually to store the final sound result in a sound file.
Cascading Sound Processing : An Algorithmic "Montage"
This example implements the following process :
1 second of sound (between 2000 and 3000 ms) is extracted from SOUND1 (
500ms of silence (
) is appended after the result (
SOUND2 is appended after the previous result (
A global fade-in/fade out of 100ms is applied to the resulting sound (
The final result is saved in the file "my-montage.aif" (
autoamtically generates the output file pathname using the OM default out-file folder]
The different programming facilities provided in OM (iterations, etc.) might be useful to automate sound processing on sound files and SOUND-DATA pointers.
In this example, we use higher-order functions in order to process lists of sound files and pointers.
mapcar sequencially cuts a segment from the sounds in the input list by calling SOUND-CUT. Note that the SOUND-CUT box is in
in order to be used as a functional argument to
. The result is a
of SOUND-DATA pointers.
The Lisp function reduce allows to use a function (left input) to combine the successive pairs of elements in a list (right input). reduce applies SOUND-SEQ with elements 1 and two in the list, then to the result and element 3, and so forth. We use this function to automatically build a sequence from our list of SOUND-DATA. Note that SOUND-SEQ is also in in
; This time it has two free inputs since reduce requires a binary operation to be supplied.
Finally the sequence is saved in a new sound file.
(More advanced processed could be imagined, and implemented with abstractions or using an omloop).