sgran


granular synthesis: synthesis involving the systematic ordering of very small sample fragments, called grains, which when organised together can create a wide variety of synthesis effects.

sgran, or stochastic granular synthesis, is a methodology developed by Mara Helmuth to manipulate grains using stochastic probabilities. As a result, sgran has a lot of p-fields, so pay attention.

Syntax:


for FM granular synthesis (see stgran for sampled-granular synthesis):

makegen(1, 24, 1000, t0, a0, t1, a1...) /* envelope of the grain in time / amplitude pairs */
makegen(2, 24, 1000, t0, a0, t1, a1...) /* shape of change in the grain density */
makegen(3, 24, 1000, t0, a0, t1, a1...) /* shape of change in the grain duration */
makegen(4, 24, 1000, t0, a0, t1, a1...) /* shape of change in the grain location */
makegen(5, 24, 1000, t0, a0, t1, a1...) /* shape of change in the carrier frequency (usually static) */
makegen(6, 10, 1000, p0, p1...) /* waveform of the grain */
makegen(7, 24, 1000, t0, a0, t1, a1...) /* shape of the modulation index */

sgran(outskip, duration, amplitude, start_grain_rate, end_grain_rate,
    low, average, hi, tightness [rate variation - beginning],
    low, average, hi, tightness [rate variation - emd],
    low, average, hi, tightness [grain duration - beginning],
    low, average, hi, tightness [grain duration - end],
    low, average, hi, tightness [grain location - beginning],
    low, average, hi, tightness [grain location - end],
    low, average, hi, tightness [pitch band - beginning],
    low, average, hi, tightness [pitch band - end])
/* tightness must be < 1. if p29 < 0 then noise is the input */

in comment form:

/*
sgran:
0       start time of group
1       duration of group
2       amplitude
3       beginning grain rate
4       ending grain rate
	amount of variation in rate: (percentage of grain rate)
5-8             beg: lo, average, hi, tightness (0-1, is 0-100%)
9-12            end: lo, average, hi, tightness (0-1, is 0-100%)
	average duration:
13-16           starting lo, average, hi, tightness
17-20           ending lo, average, hi, tightness
	location:
21-24           starting lo, average, hi, tightness
25-28           ending lo, average, hi, tightness
	pitch band AS:
29-32           starting lo, average, hi, tightness
			if p29 < 0, noise is the input
33-36           ending lo, average, hi, tightness
      input type 0=AS 1=FM 2=SAM
	*       *       *
functions: (stt variation changes are linear)

1       grain envelope
	shape of change:
2               grain density
3               grain duration
4               grain location
AS-band
5       shape of change: frequency (usually linear for all shapes)
6       waveform
FM
5       shape of change: carrier frequency
6       shape of change: c:m ratio
7       shape of change: mi
*/

An example score:

load("sgran")
output("ttt.snd")

makegen(1, 7, 1000, 0, 500, 1, 500, 0)
makegen(2, 7, 1000, 0, 50, 1, 950, 0)
makegen(3, 7, 1000, 1, 400, 0.1, 600, 0.4)
makegen(4, 7, 1000, 0, 400, 0.1, 600, 0.9)
makegen(5, 7, 1000, 0, 1000, 1)
makegen(6, 10, 1000, 1, 0.1, 0.3)
makegen(7, 7, 1000, 1, 1000, 0)

sgran(0, 3.5, 3000, 0.1, 0.005,
 0, 0.5, 0.9, 0.2,
 0.9, 0.5, 0.1, 0.7,
 0.9, 0.2, 0.9, 0.5,
 0.9, 0.5, 0.1, 0.7,
 0.1, 0.7, 0.9, 0.2,
 0.5, 0.9, 0.2, 0.9,
 200, 900, 500, 0.1,
 2000, 1000, 1500, 0.5)