Granular Synthesis and Sampling Rate Conversion

Lecture Slides

A series of gif images of the lecture slides... (only accesible from within Stanford University)

Granular Synthesis

Overview of granular synthesis techniques.


Here's a simple granular synthesis instrument in clm. Go to its own page for details...

Here is the header of the instrument and a short description of its parameters:

(definstrument grani 
    (start-time duration amplitude file
     (grains grani-grains)
     (amp-envelope grani-amp-envelope)
     (grain-envelope grani-grain-envelope)
     (grain-envelope-end grani-grain-envelope-end)
     (grain-envelope-transition grani-grain-envelope-transition)
     (grain-duration grani-grain-duration)
     (grain-duration-spread grani-grain-duration-spread)
     (grain-duration-limit grani-grain-duration-limit)
     (srate grani-srate)
     (srate-spread grani-srate-spread)
     (srate-linear grani-srate-linear)
     (srate-base grani-srate-base)
     (srate-error grani-srate-error)
     (grain-start grani-grain-start)
     (grain-start-spread grani-grain-start-spread)
     (grain-density grani-grain-density)
     (grain-density-spread grani-grain-density-spread)
     (reverb-amount grani-reverb-amount)
     (reverse grani-reverse)
     (where-to grani-where-to)
     (where-bins grani-where-bins)
     (grain-distance grani-grain-distance)
     (grain-distance-spread grani-grain-distance-spread)
     (grain-degree grani-grain-degree)
     (grain-degree-spread grani-grain-degree-spread))

Mandatory parameters

starting time in seconds
duration of the note in seconds
amplitude of the note
the complete pathname of the soundfile you want to use as source material for the grains

Optional parameters

After the name of the parameter I specify the type of parameter. Most of the key parameters can be either numbers (for a constant value) or an envelope.

amp-envelope [envelope]
amplitude envelope for the whole note
grain-envelope [envelope]
amplitude envelope for each individual grain
grain-envelope-end [envelope or nil]
alternate amplitude envelope for each individual grain. If specified, grain-envelope-transition can be used to interpolate between both envelopes over the duration of the note.
grain-envelope-transition [envelope]
interpolation envelope for the grain envelope (used only if grain-envelope-end has been specified).
grain-duration [number or envelope]
duration in seconds of each individual grain
grain-duration-spread [number or envelope]
random deviation from grain-duration
grain-duration-limit [number]
minimum duration of a grain
srate [number or envelope]
sample rate conversion factor. The value for each grain is either a constant if the parameter is a number or is determined by the value of the envelope at the point in time where the grain starts. The sample rate conversion factor is a constant within the grain.
srate-spread [number or envelope]
random deviation the value of srate
srate-linear [t or nil]
defines the type of envelope used for the sampling rate conversion factor:
nil (the default): "srate" is expressed in fractional semitones above or below the original sampling rate (0 = no change in sampling rate). The exponential envelope is approximated by a linear segment representation. The error bounds of the approximation can be set by srate-error. The base of the exponential curve can be changed by srate-base.
t: "srate" is the linear sampling rate conversion factor (1 = no change in sampling rate).
srate-error [number]
error bound for the exponential conversion
srate-base [number]
base for the exponential conversion. "2" will express the envelope in octaves. "(expt 2 (/ 12)" will express the envelope in semitones.
grain-start [number or envelope]
point in the input file where the samples are going to be read. "0" represents the start of the input soundfile, "1" represents the end.
grain-start-spread [number or envelope]
random deviation from the value of grain-start.
grain-density [number or envelope]
number of grains per second that will be created.
grain-density-spread [number or envelope]
random deviation from the value of grain-density.
reverse [t or nil]
"t" means the input soundfile will be read backwards.
reverb-amount [number]
amount of sound to be sent to the reverb output stream.
grain-distance [number or envelope]
distance to the listener position (for locsig)
grain-distance-spread [number or envelope]
random deviation from the value of grain-distance
grain-degree [number or envelope]
angular position (for locsig)
grain-degree-spread [number or envelope]
random deviation from the value of grain-degree
Some examples...

Here's the "one-cut" instrument, a soundfile mangling machine... (cut.ins). Here are some parameter examples you can paste into a with-sound.

To probe further

Use the "grani" granular synthesis instrument for processing (ie: mangling) input soundfiles. Create some interesting transformations on the input. Make soundfiles sing and or sttttttutttter. There are some soundfiles available for use (or you can roll your own). You can find a small gong in "/usr/ccrma/web/CCRMA/Courses/SoundSynthesis/Lectures/4/Sounds/small-gong.snd", a small cowbell in the same directory, file name "cencerros-1.snd", a cymball and a tubular bell... Have fun!

©1997 Fernando Lopez-Lezcano. All Rights Reserved.