Additive, Wavetable, Modulation Synthesis and Simple FMLecture SlidesA series of images of the lecture slides... A .emacs fileHere is the .emacs file that I used for starting the lisp interpreter and interacting with it. Just copy it to your home directory and restart xemacs (or merge the contents with what you currently have in your .emacs). 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 short list of things to doThis is a typical cycle for compiling and running clm instruments:
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.
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))) AssignmentCreate a "Modulation Song" using the example instruments (or custom versions of them, needless to say adding envelopes to control parameters would make most of them much more interesting...). Plug in parameters and experiment with them. Experiment with different amplitude envelopes (for example: create percussive attacks). Doesn't have to be very long, 1 minute tops! Have fun! Email the source code (including instruments) to Damian Keller when you're done, remember to include all we need to recreate the piece. |
©2000-2002 Fernando Lopez-Lezcano. All Rights Reserved. nando@ccrma.stanford.edu
|