Introduction to CLM
Here's a more detailed look at the lisp world as usually used here at ccrma... Three different packages are compiled as part of the Common Lisp executable, CLM (sound synthesis and processing), CMN (common music notation) and CM (algorithmic composition).
Several ways to run lisp at ccrma... During the workshop we will be using Linux and we'll be running the common lisp executable image as a subprocess of the xemacs editor.
The source files are usually ".lisp" or ".ins" (instrument) files. The compilation process generates a fast load compiled file, ".fasl"/".fisl" or ".fusl" depending on the platform you are running and a object file ".o" or ".so" depending on the platform.
A very simple instrument, just one sine wave with an envelope. You'll see the basic components of an instrument repeated over and over. The basic components are always the same...
Let's split it into three parts so that we can analyse it easily. The first part declares the instrument (defines and names the instrument and its parameters), the second part defines the "unit generators" or black boxes that will be connected together in the third part. The third part is the "run" loop that generates the samples that are merged into the output soundfile. It "connects" together the unit generators and creates a sample (number) for each iteration of the loop.
"make-oscil" creates the oscillator, "oscil" uses it; "make-env" creates the envelope, "env" uses it.
WARNING: the code in the slide has an obsolete function in it, please use the code below it
and here's the text:
(definstrument simp (start-time duration frequency amplitude &key (amp-env '(0 0 50 1 100 0))) (multiple-value-bind (beg end) (times->samples start-time duration) (let ((s (make-oscil :frequency frequency)) (amp (make-env :envelope amp-env :duration duration :scaler amplitude))) (run (loop for i from beg to end do (outa i (* (env amp) (oscil s))))))))Some ways to use our sinewave oscillator through the "with-sound" macro:
This is what you do to interact with clm, first create a file with the instrument code in it, compile and load it in the lisp interpreter, test it. If not happy then edit it and go back to the beginning of the loop. Sometimes testing involves just changing parameters to the instrument call and that does not require a recompilation...
©1996-2001 Fernando Lopez-Lezcano. All Rights Reserved. nando@ccrma.stanford.edu
|