next up previous contents
Next: Sound-Utilities Up: SND Previous: FM synthesis on SND

A simple tutorial of STK on Scheme and SND

Perry Cook and Gary Scavone describe STK as a set of audio signal processing C++ classes and instruments for music synthesis. The scheme counterpart are a set of instrument primarily following the plucked string, bowed string, flute, clarinet and brass families of Physical Models. You can combine these instruments to create programs which make cool sounds using a variety of synthesis techniques.

More on STK

At CCRMA you can copy the file prc95.scm to your /zap directory by issuing the next commands:

 		 scp /usr/ccrma/lisp/src/snd/prc95.scm /zap/prc95.scm        
Alternatively you can look in the SND distribution for this file and also place it in your /zap or /tmp directories.

Open this file with Xemacs or with your favorite text editor.

Start your STK or rather Physical modeling experimentation with the usual steps for working with SND and scheme

  1. Open a new sound in SND
     		  (new-sound "/zap/test.snd") or (open-sound "/zap/test.snd")        
  2. And now load your STK instruments,
     		  (load "prc95.scm")        

Careful analysis of the code will make you aware of these instruments and their calls:

  • Plucked string -> plucky
  • Bowed string -> bow
  • Brass Horns -> brass
  • Clarinet -> clarinet
  • Flute winds -> flute

Also notice the parameters for the scheme function call.

 		   (beg dur freq amplitude maxa)       
Where beg is start time of sound, dur is the duration of the sound, freq is the frequency in Hertz of the sound, amplitude is attack intensity or initial pressure of the sound and maxa is the overall maximum amplitude of the Physical Model. Note that there is a ratio between amplitude and maxa. You can read more about these parameters on the STK web pages, in the various paper written on the subject by Perry Cook and Gary Scavone or you can simply read the code to figure them out.

You can listen to the plucked string by typing the following function call in the SND listener:

 		  (plucky 0 2 505 .7 1.0)        
In this case the start time is zero, duration of sound is 2 seconds, frequency is 505Hz and amp is 0.7 while maximum output is function of 1.0.

Try the following plucked sound:

 		  (plucky 0 0.3 643.4317 .2 1.0)       
and try to perceive the difference.

A very long and low clarinet sound might be:

 		  (clarinet 0 4 300 .7 1.2)       
If it sounds like a clarinet, try to play expression markings by changing the amplitude and maxa ratio. And what about if you want to add vibrato ?

Next, here is a sequence of brass sounds:

     (define (brassy)
       (brass 0 .5 261.62555 .6 1.2)
       (brass 1 .8 391.99542 .4 1.1)
       (brass 2 1.4 523.2511 .4 1.1)
       (brass 3.5 .5 261.62555 .6 1.2)
       (brass 4 .8 391.99542 .4 1.1)
       (brass 5 1.4 523.2511 .7 1.1)
       (brass 7 .4 698.4565 .8 1.2)
       (brass 7.8 1.6 391.99542 .2 1.0)
       (brass 9 2 261.62555 .3 1.6))
In this case we are defining a scheme function called ``brassy'' which carries the score for the physical model. This is sort of like the ``SKINI'' protocol for the C++ version of STK. Please note the different start times and durations and very important!! don't take for granted that start times are function of durations themselves.

In order to make sound you type the following function call on the scheme listener.

Try to experiment changing the order of those sound and make them sound more like a wake up call bugle.

More to come !!! on STK and physical modeling in SND.

next up previous contents
Next: Sound-Utilities Up: SND Previous: FM synthesis on SND

© Copyright 2001-2006 CCRMA, Stanford University. All rights reserved.
Created and Mantained by Juan Reyes