CCRMA

Granular Synthesis


Lecture Slides

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


Granular Synthesis

Overview of granular synthesis techniques.


Examples

Here's a fairly comprehensive granular synthesis instrument written in clm (grani.ins) and geared towards granulation of soundfiles.

Here is the header of the instrument and a short description of its parameters (see the source code for the parameter defaults):

(definstrument grani 
    (start-time duration amplitude file
		&key
		(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

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

Some of the 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]
a second 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 in seconds 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. If not overriden by the sampling rate conversion factor is specified in semitones (positive values transpose the sound up and negative values transpose down).
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 conversion). 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 from. "0" represents the start of the input soundfile, "1" represents the end. An envelope can be used to produce arbitrary mappings over time.
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 (each grain will read backwards but of course this is independent from grain-start, for example we could be advancing forwards in the file but reading the samples 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...

  • Just a silly stuttering gong:
    (with-sound()(grani 0 8 2 
                        "/usr/ccrma/web/html/courses/220b/topics/granularsynthesis/sounds/small-gong.snd"))
    
  • Smaller grains:
    (with-sound()(grani 0 8 3 
                        "/usr/ccrma/web/html/courses/220b/topics/granularsynthesis/sounds/small-gong.snd"
                        :grain-duration 0.06 :grain-density 40 
                        :grain-density-spread 5 :grain-start '(0 0.3 1 0.4)))
    
  • Smaller grains, downsampled by an octave:
    (with-sound()(grani 0 8 3 
                        "/usr/ccrma/web/html/courses/220b/topics/granularsynthesis/sounds/small-gong.snd" 
                        :grain-duration 0.06 :grain-density 40 
                        :grain-density-spread 5 :grain-start '(0 0.1 1 0.22) 
                        :srate -12))
    
  • Smaller grains, downsampled by a 0.3x factor. Note that we change the position were we start sampling the input file and create a big spread there so that we are actually jumping around randomly:
    (with-sound()(grani 0 8 3 
                        "/usr/ccrma/web/html/courses/220b/topics/granularsynthesis/sounds/small-gong.snd" 
                        :grain-duration 0.06 :grain-density 40 :grain-density-spread 5 
                        :grain-start '(0 0.1 1 0.22) :grain-start-spread 0.2 :srate -12))
    
  • Three notes spread in the stereo field:
    (with-sound(:channels 2 :statistics t)
    (grani 0 8 2.4 "/usr/ccrma/web/html/courses/220b/topics/granularsynthesis/sounds/tubular-bell.snd" 
           :grain-duration 0.06 :grain-density 20 :grain-density-spread 2 :srate 0)
    (grani 0 8 2.4 "/usr/ccrma/web/html/courses/220b/topics/granularsynthesis/sounds/tubular-bell.snd" 
           :grain-duration 0.08 :grain-density 20 :grain-density-spread 2 :srate 5  
           :grain-degree 0)
    (grani 0 8 2.4 "/usr/ccrma/web/html/courses/220b/topics/granularsynthesis/sounds/tubular-bell.snd" 
           :grain-duration 0.05 :grain-density 35 :grain-density-spread 3
           :srate -5 :grain-degree 90))
    

    Try replacing the turkish-cymbal-1.snd soundfile instead of the tubular-bell...


©1998,2001-2005 Fernando Lopez-Lezcano. All Rights Reserved.
nando@ccrma.stanford.edu