Snd can use either s7 (a Scheme interpreter), ruby and even Forth as internal scripting languages. For example to create a new sound from an s7 instrument, we can start with the outstanding Birds instrument written by Bill Shottstaedt, and also known as “bird.scm”. Try typing the following commands on Snd's listener. You might need to copy “bird.scm” into your working directory.
|
At first code might be intimidating but to get acquainted with s7 language, a simple “hello-world” sine instrument in s7-Scheme might look like:
|
You can copy and paste this instrument to your favorite text editor although we recommend an emacs like editor (here you cab have SND as an inferior-lisp process). Once saved as yoursine.scm you can load it to the interpreter by typing:
|
This definition of sine has the following parameters in the lambda
list: beg as for offset or beginning of sound,dur
for durations of the sound freq for frequency and
amp for amplitude or volume of the sound which in this case
should be less than one. Therefore to create a sound file with a
simple 1000Hz sine tone you type:
|
If you want successive beep tones then you can type something like:
|
|
Take a look at the code for another “sine” instrument, this time using s7's oscil unit generator, producing same results as above. -It might be easier to understand for people used to Music-N software synthesis packages-.
|
On the listener function calls for this instrument also involve beginning or offset of sound, duration, frequency, and intensity volume or amplitude. To get sound you use “(with-sound ()())” macro to trigger the the instrument. Copy-and-paste this code to a new file and then load it with the listener into Snd's s7. Once loaded:
|
Above we can see waveform of a sinusoidal sound generated with “sine-snd” or with the “simpler” instrument code definition on s7.
|
Edit envelope window with an enveloped waveform of the sinusoidal sound. The envelope editor here is a graphical-user-interface where you click to select breakpoints. On this case you have a waveform behind the envelope. Envelopes can be used for amplitude (this case), moving filtering parameters or sample rate conversion.
CONVOLUTION BETWEEN TWO SOUND FILES:
———————————————————-
A basic Signal Processing instrument to do “Fourier Convolution” instrument which can be found on examples.scm as part of the SND distribution is written as follows. Copy and paste this code to a .scm file in your home directory or in the /zap directory and save it as “myconvolve.scm”
|
|
|
|
|
|
© Copyright 2001-2022 CCRMA, Stanford University. All rights reserved.
Created and Mantained by Juan Reyes