Lecture 4
Frequency Modulation and some CLM examples

Frequency Modulation


Here are a bunch of fm instruments, mostly coming from the clm area ("/Lisp/clm"). You should explore, there's a wealth of information and examples hiding there...


The 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

starting time in seconds
duration of the note in seconds
frequency of the note in Hertz
amplitude of the note (between 0 and 1)
amplitude envelope. A list of time-value coordinates that determines the evolution of loudness over time. The time values are relative and are scaled to the duration of the note (for example I usually use a time axis that stretches between 0 and 1).
modulation index envelope. A list of time-value coordinates that determines the evolution of modulation index over time. The modulation index controls the "brightness" of the sound (the higher the index the brighter the resulting sound).
modulation index. The scaler for the index envelope.

Optional parameters

angle in degrees from where the sound is coming from in a stereo rendition. "0" is left and "90" is right; "45" is right in the middle of the stereo field.
distance in feet from where the sound is coming from.
amount of reverberation added to the sound. For this to work you must have a reverberator loaded and the with-sound call has to specify it.

Some random with-sound's

doesn'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)
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)
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)
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)


A 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 
                        (high nil)
                        (degree 0.0)
                        (distance 1.0)
                        (reverb-amount 0.01))

Mandatory parameters

modulation index.

Optional parameters

"t" introduces an upwards glissando in the end of the note (the glissando function is a constant hardwired into the instrument, it could be made a parameter, of course).

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))


A 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
                     (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 violin

A generic and vey 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)

Mandatory parameters


Optional parameters

fm-violin-fm-index 1.0
overall modulation index.
fm-violin-amp-env '(0 0 25 1 75 1 100 0)
amplitude envelope.
fm-violin-periodic-vibrato-rate 5.0
periodic vibrato frequency (periodic vibrato is a triangular wave).
fm-violin-random-vibrato-rate 16.0
random vibrato rate (random noise added to the vibrato).
fm-violin-periodic-vibrato-amplitude 0.0025
amplitude of the periodic vibrato.
fm-violin-random-vibrato-amplitude 0.005
amplitude of the random vibrato.
fm-violin-noise-amount 0.0
add index and amplitude noise (internal movement of the sound).
fm-violin-noise-freq 1000.0
bandwidth of the index and amplitude noise.
fm-violin-ind-noise-amount 0.0
index noise amount
fm-violin-ind-noise-freq 10.0
bandwidth of index noise.
fm-violin-amp-noise-amount 0.0
amplitude noise amount
fm-violin-amp-noise-freq 20.0
bandwidth of amplitude noise.
fm-violin-gliss-env '(0 0 100 0)
glissando envelope (pitch envelope)
fm-violin-glissando-amount 0.0
scaler for the pitch envelope.
fm-violin-fm1-env '(0 1 25 .4 75 .6 100 0)
index envelope for first modulator
fm-violin-fm2-env fm-violin-fm1-env
fm-violin-fm3-env fm-violin-fm1-env
fm-violin-fm1-rat 1.0
modulator / carrier frequency ratio for first modulator.
fm-violin-fm2-rat 3.0
fm-violin-fm3-rat 4.0
fm-violin-base nil
kind of interpolation to be done between envelope points.
fm-violin-frobber nil
fm-violin-reverb-amount 0.01
reverberation amount.
fm-violin-index-type :violin
fm-violin-denoise nil
whether to try to reduce quantization noise in envelopes.
fm-violin-index1 nil
modulation index for the first modulator.
fm-violin-index2 nil
fm-violin-index3 nil

Some example with-sound's

For a compilation of examples on how the fm-violin can sound load the /Lisp/clm/fmviolin.clm file. Here's the soundfile (fmviolin.snd) created by loading the file (will save you some time since the sounds take a while to get compiled). Please be aware that for this example to work you will have to compile and load a reverberator (jcrev.ins). If you want to play with the lisp code inside 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 voice

Chowning'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 glissat glissdc glissamt at1 at2 dc1 dc2)

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 .1 .1 0 .1 .1 .1 .1)))


Time for notes to sing with internal movement. This week's assignment will seem at first to be fairly easy. Just create three notes and you are done. Each note has to be at least 30 seconds long. Now, a note that does nothing for 30 seconds can be fairly boring and we don't want to get bored. "Real" sounds have always internal movement going on. That's where envelopes step forward as controllers. Use them and make them move the internals of the sound while it is singing. If the supplied envelopes are not enough add your own... Have fun!

NOTE: take a look at "/LocalApps/". It's a small application you can use to graphically edit envelopes. It works by using the pasteboard as the communication channel between text and graphics. If you paste a list of x-y points it plots the graph. If you press "copy" while in the graphics window a list of numbers if copied in the pasteboard (be sure to select the correct format before doing the copy).

©1996 Fernando Lopez-Lezcano. All Rights Reserved.