Music 220b: Winter 2001
Fernando Lopez-Lezcano, instructor
Christopher Burns, teaching assistant
Tamara Smyth, teaching assistant
Week 1: the (with-sound) macro
The (with-sound) macro is our first tool for getting sound out of CLM. Let's see some examples using Fernando's wavetable ring-modulation instrument.
- First copy the file from the lecture 1 webpage into the /zap directory by shift-clicking on the link from your browser. Then fire up xemacs and start the lisp interpreter:
- To compile and load the instrument, go to the lisp prompt and type:
- Here's a basic (with-sound) call to the instrument, starting at time zero, lasting 4 seconds, with a carrier frequency of 400, a modulator frequency of 20, and an amplitude of 0.5:
(with-sound () (rmw 0 4 400 20 0.5))
- Here's another call which returns some statistics on the computation:
(with-sound (:statistics t) (rmw 0 4 410 35 0.5))
- And another which writes a soundfile called "/zap/ringmod.snd":
(with-sound (:output "/zap/ringmod.snd") (rmw 0 4 410 35 0.5))
- This one writes a stereo soundfile at a CD-quality sampling rate. Note that the instrument is only capable of mono, so the second channel is silent:
(with-sound (:channels 2 :srate 44100) (rmw 0 4 440 110 0.5 :carrier-spectr '(1 0.5 3 0.25 5 0.125 7 0.0625)))
- added 1.16.2001: today Fernando discussed the :reverb, :reverb-data, and :decay-time parameters for (with-sound). :reverb specifies the reverb instrument to be applied, :reverb-data sets the parameters for that reverb, and :decay-time extends the soundfile so that the reverb tail won't be cut off. Note that you have to use a reverb-savvy instrument (for example, instruments which use the locsig unit generator), and you have to have already compiled and loaded the reverberator into your lisp session.
More examples are available as part of the CLM documentation.
Course resources main page
220b main page