How Granular Synthesis and Windowing Functions Work
Slicing sound into millisecond-scale grains and re-weaving them: the math behind granular synthesis and the windowing functions that keep the clicks out.
Granular synthesis slices an audio file into millisecond-scale 'grains' and reassembles them at varying speed, order, and density. Its most powerful trait is decoupling time from pitch — you can stretch a sound's duration while keeping its original tone, or shift its pitch while holding the duration fixed. Sci-fi ambiences, imaginary creature breaths, and texture-rich atmospheres are largely built with this technique.
Why Windowing Is Necessary
If a grain is taken raw, with a hard cut at its start and end, that sudden amplitude jump produces an audible 'click' or 'crackle' — an unwanted artefact in digital audio. Windowing functions taper the grain's start and end smoothly down to zero, removing that abrupt transition. When thousands of grains are then strung together, the ear hears a continuous, smooth texture instead of individual jumps.
The shape of the window function doesn't just prevent clicks — it shapes the grain's perceived character too: a narrow, sharp window gives a more percussive, granular texture, while a wide, soft window fuses the grains together into a smoother, more cloud-like continuous bed. Choosing a window is as much an aesthetic decision as a technical necessity.
Three Common Window Types
- ―Hann: tapers the grain edges all the way to zero, giving the cleanest spectral result — the default choice for general-purpose granular work.
- ―Hamming: doesn't taper fully to zero, giving a slightly more 'lively' response, but carries a small click risk because of that incomplete taper.
- ―Gaussian: a bell-curve-shaped window with a strong centre and very soft edges — preferred for dense, overlapping grain clouds.
The Rise of Procedural Sound
Granular synthesis is one of the building blocks of procedural sound design. As Andy Farnell argues, generating wind or fire in real time according to the rules of physics — instead of playing back a static .wav file — treats sound as a living process rather than a fixed asset. In game engines (Wwise, FMOD, Unreal's MetaSounds) this approach is becoming standard: the same wind sound is never repeated identically, because it's synthesised live, every time.
The cost of this approach is computational power: real-time granular synthesis consumes far more CPU than playing back a pre-rendered file, because the system is generating and combining thousands of grains on the fly, continuously. Since that budget is limited on consoles and mobile devices, procedural sound engines usually strike a deliberate balance between 'generate this live' and 'fall back to a pre-rendered asset'.