Introduction to CLM and LispLecture SlidesA series of images of the lecture slides... [NOTE: not all of this will be covered in the first lecture] Links to online documentationFM resourcesHere are a couple of links to interesting stuff about Frequency Modulation:Common Lisp resourcesCommon Lisp is the computer language underlying Common Lisp Music, Common Music and Common Music Notation. Here are some links with information about the language itself:
Touretsky's book, "Common Lisp: A Gentle Introduction to Symbolic Computation" is actually online as either ps or pdf files. WARNING: DO NOT PRINT THIS AT CCRMA!, it is 600 pages long and does not print cleanly as a whole, please do not waste paper and tie up the printer. You have been warned. There is a local copy for you to open in a pdf or Postscript viewer at: "/usr/ccrma/lisp/docs/touretzky/" (you do not need to download it again from the link below).
Some info about Common Lisp's loop macro: The definite reference to the loop macro in Steele's book. Common Lisp concepts you will need to knowWe will go through this in the first lecture...
Things you will need to doIf you use the recommended method of running your lisp interpreter inside the xemacs editor you will need to customize the xemacs configuration file. Why xemacs? Xemacs can run your lisp interpreter in a window inside xemacs - it is easy to switch between the code and the interpreter and the same editing commands that you use to edit code can be used to edit previously entered commands in the interpreter. Xemacs can highlight syntax, it shows matching parenthesis and can highligh regions. Xemacs can automatically indent your code - this is very important to "see" the structure of a lisp program (when you start a new line type [tab] and the cursor will jump to the proper indentation level automatically).How to use xemacsA complete tutorial is beyond the scope of this page, but here is a very useful link with the most useful commands: Almost all of these commands are also available as menu entries or icons you can click on, if you want to excercise your mouse. I find it faster to just type (obviously there is a learning curve while you memorize the key sequences). A .emacs fileHere is the .emacs configuration file that I used for starting the lisp interpreter and interacting with it. Just insert this code at the end of your ~/.xemacs/init.el file and restart xemacs (or merge the contents with what you currently have in your configuration file if you have customized it). With this in place you should be able to ([ctl]-x means press the control key and x at the same time):
Check the emacs cheat sheet for a list of the most commonly used commands... A very simple CLM instrument"Simp" is a bare bones CLM instrument, just a sine wave oscillator with an envelope. Analyzing simp will teach you a lot about lisp and CLM. There are two approaches: build simp one step at a time, or take the whole thing apart and explain what each part does. Both approaches are taken in the following two sections: Dissecting simpA very tiny instrument written in clm-2 and a lot of information on how it is built... Building simpThe step by step process of building a clm instrument one piece at a time (as done in class). Includes some comments on what each version adds to the preceding one. simpbuild.ins.
This is a typical cycle for compiling and running clm instruments:
Cellular AutomataFirst of all some references on cellular automata:
Some topics:
Unidimensional automataHere's the example I developed over last class. It implements a one-dimensional automata. Each cell of the automata is a small state machine with just two states. The transition between states is determined by the state of its two adjoining neighbors... And a very good explanation of what's going on by Matt Wright:Some synthesis methodsAdditive and Wavetable SynthesisPeriodic waveform synthesisf(t)=sum,k=0,...(Ak*sin(kwt+Qk)) [Moore 210]
Partial based synthesisf(t)=sum,k=0,...(Ak*sin(wkt+Qk)) [Moore 210]
Time varying synthesisAk=f(t)Wk=f(t) Qk=f(t)
Modulation SynthesisRing ModulationAmplitude ModulationSimple Frequency ModulationExamples
Examples from the clm distribution:
Another fancy example that uses additive synthesis (and some frequency modulation):
Here are a bunch of fm instruments, mostly coming from the clm area ("/usr/ccrma/lisp/src/clm-2"). You should explore, there's a wealth of information and examples hiding there...
bell.insThe eternal "fm bell". Here is the header of the instrument and a short description of its parameters:
(definstrument fm-bell (start-time duration frequency amplitude amp-env index-env index &optional (degree 0.0) (distance 1.0) (reverb-amount 0.005)) Mandatory parameters
Optional parameters
Some random with-sound'sdoesn't sound like a bell...
(with-sound()(fm-bell 0 4 440 0.1 '(0 0 0.05 1 0.2 0.4 0.8 0.2 1 0) '(0 0 0.02 1 0.2 0.2 0.8 0.1 1 0) 1))so let's tweak envelopes a bit...
(with-sound()(fm-bell 0 4 440 0.1 '(0 0 0.002 1 0.2 0.4 0.8 0.2 1 0) '(0 0 0.001 1 0.1 0.08 0.8 0.01 1 0) 1))maybe try a duller bell?
(with-sound()(fm-bell 0 4 440 0.1 '(0 0 0.002 1 0.2 0.4 0.8 0.2 1 0) '(0 0 0.001 1 0.1 0.08 0.8 0.01 1 0) 0.3))but with a different envelope and a lower frequency it's not a bell any longer... (but sounds like the typical fm wow)
(with-sound()(fm-bell 0 4 78 0.1 '(0 0 0.3 1 0.4 0.9 0.8 0.2 1 0) '(0 0 0.35 1 0.38 0.9 0.8 0.01 1 0) 0.7)) drum.insA drum simulation. Here is the header of the instrument and a short description of its parameters:
(definstrument fm-drum (start-time duration frequency amplitude index &optional (high nil) (degree 0.0) (distance 1.0) (reverb-amount 0.01)) Mandatory parameters
Optional parameters
Some example with-sound's(with-sound () (fm-drum 0 1.5 55 .3 5 nil) (fm-drum 2 1.5 66 .3 4 t)) gong.insA very nice gong simulation. Here is the header of the instrument and a short description of its parameters:
(definstrument gong (start-time duration frequency amplitude &key (degree 0.0) (distance 1.0) (reverb-amount 0.005)) Mandatory parameters
Optional parameters
Some example with-sound's(with-sound () (gong 0 3 261.61 .6)) Fm violinA generic and very versatile fm instrument created by Bill Schottstaedt. A nice example of multipurpose coding. Almost everything has reasonable defaults but can be changed. If you examine the code you'll see another feature common to good instruments. The key parameters are defaulted to the value of special (global) variables. That opens the possibility of globally changing the behaviour of a bunch of notes by just encasing them in a "let" with redefinitions of those global variables. Here is the header of the instrument and a short description of its parameters (which has plenty off):
(definstrument fm-violin (startime dur frequency amplitude &key (fm-index fm-violin-fm-index) (amp-env fm-violin-amp-env) (periodic-vibrato-rate fm-violin-periodic-vibrato-rate) (random-vibrato-rate fm-violin-random-vibrato-rate) (periodic-vibrato-amplitude fm-violin-periodic-vibrato-amplitude) (random-vibrato-amplitude fm-violin-random-vibrato-amplitude) (noise-amount fm-violin-noise-amount) (ind-noise-freq fm-violin-ind-noise-freq) (ind-noise-amount fm-violin-ind-noise-amount) (amp-noise-freq fm-violin-amp-noise-freq) (amp-noise-amount fm-violin-amp-noise-amount) (noise-freq fm-violin-noise-freq) (gliss-env fm-violin-gliss-env) (glissando-amount fm-violin-glissando-amount) (fm1-env fm-violin-fm1-env) (fm2-env fm-violin-fm2-env) (fm3-env fm-violin-fm3-env) (fm1-rat fm-violin-fm1-rat) (fm2-rat fm-violin-fm2-rat) (fm3-rat fm-violin-fm3-rat) (fm1-index fm-violin-index1) (fm2-index fm-violin-index2) (fm3-index fm-violin-index3) (base fm-violin-base) (frobber fm-violin-frobber) (reverb-amount fm-violin-reverb-amount) (index-type fm-violin-index-type) (degree nil) (distance 1.0) (no-waveshaping nil) (denoise fm-violin-denoise) (denoise-dur .1) ;used to be .5 (denoise-amp .005) &allow-other-keys) Mandatory parameters
Optional parameters
Some example with-sound'sFor a compilation of examples on how the fm-violin can sound load the fmviolin.clm file. The 20 Mbyte soundfile created by loading fmviolin.clm into lisp after compiling and loading both v.ins and jcrev.ins is at /usr/ccrma/web/html/courses/220b/lectures/1/examples/fmviolin.snd (this will save you some time since the soundfile take quite a long time to be created). Start a copy of "snd" and load the file in it to play the example. Please be aware that for this example to work you will also have to compile and load a reverberator (jcrev.ins). If you want to play with the lisp code inside fmviolin.clm I strongly suggest you take apart the file and create a small with-sound for each example you are interested in... the whole soundfile is almost 20Mbytes long.
Fm voiceChowning's fm voice instrument.
(definstrument fm-voice (beg dur pitch amp vowel-1 sex-1 ampfun1 ampfun2 ampfun3 indxfun skewfun vibfun ranfun dis pcrev deg vibscl pcran skewscl ranpower glissfun glissamt) Some example with-sound's(let ((ampf '(0 0 1 1 2 1 3 0))) (with-sound (:wait t) (fm-voice 0 1 300 .8 3 1 ampf ampf ampf ampf ampf ampf ampf 1 0 0 .25 1 .01 0 ampf .01))) |
©2000-2004 Fernando Lopez-Lezcano. All Rights Reserved. nando@ccrma.stanford.edu
|