Lesson 10

Granular

Nine lessons have treated sound as a spectrum: something with partials, to be specified, generated, stored or simulated. The last method throws that away and treats sound as a great many very short events instead, which turns out to be a different way of thinking about everything that came before it.

The other axis

A sound can be described by what frequencies it contains, which is what every method so far has done. It can equally be described by what it does moment to moment, and those are two views of the same object rather than two different objects.

Granular synthesis works entirely in the second view. Chop sound into fragments a few milliseconds long, called grains, fade each one in and out, and scatter thousands of them per second. No partial is ever mentioned. The spectrum, again, is a consequence.

Dennis Gabor proposed this in 1946, as a theory of hearing rather than a way to make noise. Iannis Xenakis composed with it in the 1950s using tape and scissors, which is exactly as laborious as it sounds, and Curtis Roads and Barry Truax made it practical once computers could schedule the grains.

The threshold, for the second time

Start the figure below with the density low. You hear individual ticks: separate events, countable, a rhythm. Raise the density and somewhere around twenty grains a second the ticks stop being ticks and become a continuous tone with a pitch.

That should feel familiar. It is the same boundary lesson 4 crossed when a modulator went past 20 Hz and a wobble became a colour. Two completely unrelated mechanisms, one threshold, because the threshold is not in either mechanism. It is in the listener.

Grains, and when they stop being events

Every grain is the same 1 kHz sine. Everything else you hear is the cutting.

Press play to see the trace

You hear it as
events
Spectral width
48 Hz
Overlap
0.24×
Grains per minute
480

A grain 30.0 ms long cannot have a precise frequency. Its spectrum is about 48 Hz wide, because a Hann-windowed burst spreads to roughly 1.45 / duration whatever is inside it. Shorten the grain and watch the single 1 kHz line widen into a hill. The figure is not at fault there. Knowing exactly when a sound happened and knowing exactly what pitch it was are traded against each other, and this is the exchange rate.

Why a short grain has no exact pitch

Every grain in that figure contains the same pure 1 kHz sine, so the content contributes exactly one line to the spectrum. Anything else you can see was put there by the cutting.

And there is plenty else. Shorten the grains and that single line widens into a hill. A grain 50 ms long has a spectral width of about 29 Hz; at 5 ms it is 290 Hz; at 2 ms it is over 700. Multiply width by duration and you get about 1.45 every time, because a Hann-windowed burst spreads to roughly 1.45 / duration regardless of what is inside it.

That constant is the whole lesson of the first figure. You cannot know both exactly when a sound happened and exactly what pitch it was: shortening the grain buys timing and spends frequency, and lengthening it does the reverse. It is Gabor's uncertainty relation, it is the same mathematics as Heisenberg's and not merely an analogy to it, and every spectrum analyser in this course has been quietly subject to it.

Including the ones you have been reading. The analyser drawing these traces uses an 8192-sample window, which at 48 kHz is 171 ms, which by the rule above buys a resolution of about 8.5 Hz. That is why it can separate the low harmonics of a bass note into countable spikes, and it is also why it cannot tell you precisely when anything happened. Choosing that window was choosing a point on this trade, and the choice was made in lesson 1.

Where the technique earns its living

Everything so far is a curiosity. The reason granular synthesis is in every DAW you have ever opened is a consequence nobody was looking for.

If you read grains out of a recording, two numbers control the result and they are entirely separate. How fast the read position crawls through the source decides how long the passage takes. How fast each individual grain is played decides what pitch it is. Nothing connects them.

On a tape machine, a record player or a sampler those are the same knob: play it slower and it goes down. Pulling them apart is what granular does, and it is why you can stretch a vocal to four times its length without it becoming a growl, or transpose a drum loop without it getting faster.

Time and pitch, on separate knobs

Three notes, granulated. Slow the read head right down and the pitch does not move.

Press play to see the trace

Source
2.40 s
One pass takes
2.4 s
Transposed by
0.0 st
Read position
0.00 s

The source is 2.40 seconds long and one pass currently takes 2.4. Nothing about the pitch changed to achieve that, because the read head and the grains are not connected: one decides where in the source we are, the other decides how fast each fragment is played. Take the read speed to its minimum and the phrase becomes a slowly shifting drone, which is the same three notes examined very slowly rather than a slowed-down recording of them.

What it is bad at

It is a texture machine, not a note machine. The natural products of granular synthesis are clouds, swarms, drones and washes. Getting a clean, articulate melodic line out of it is possible and is fighting the technique, in the same way that getting an unphysical sound out of a physical model is.

The window is not optional. Cutting a fragment out of a signal leaves discontinuities at both ends, and a discontinuity is a click. At two hundred grains a second that is a buzz at the grain rate laid over everything. Every grain in both figures above is faded in and out, and the difference between doing that and not doing it is the difference between granular synthesis and a fault.

Regularity is audible. Perfectly evenly spaced grains produce a periodic comb in the spectrum, which reads as an extra pitch that nobody asked for. That is what the jitter control in the first figure is for, and it is why real granular instruments randomise almost everything by default.

Five answers, one question

That is the second half of the course finished, and it is worth putting the five methods next to each other, because they were never really five subjects. They were five answers to the question lesson 6 asked: how do you get a rich, evolving spectrum without paying an oscillator for every partial in it?

  • Additive pays. Total control, and a bill nobody wants.
  • FM manufactures partials with a nonlinearity. Almost free, exactly predictable, hard to steer.
  • Wavetable works them out in advance. Memory instead of arithmetic, and a control no filter can imitate.
  • Physical modelling declines to describe the spectrum at all and simulates the object instead. Cheap, physical controls, and hard to make unreal.
  • Granular leaves the frequency domain entirely and builds from fragments of time. Textures rather than notes, and it accidentally solved time-stretching.

None of them is better. Each is a different place to spend a fixed budget, and knowing which is which is most of what it means to understand a synthesizer.

You started with a flute and a violin playing the same note, and a claim that whatever separates them is a spectrum and a shape in time. Ten lessons later, every control on every synthesizer you are likely to meet is something you can account for: what it does, why it exists, what it costs, and what the designer gave up to have it.

If you have not read it, Foundations takes the other road from the same starting point, and ends up explaining why there are twelve notes rather than why they sound like anything. Otherwise, go and open a synthesizer and look at the panel. It should read differently now.

Battuto is a free set of courses from Aphelion. We also make Phonon, a DAW built on everything in these lessons.