Granular
Slice audio into grains and reassemble them into a new signal.
What it does
Granular breaks an audio source into a stream of overlapping micro-grains, short slices only tens of milliseconds long, and reassembles them into a new sound. Each grain is drawn from a scan position in the source, shaped by an envelope so it fades in and out cleanly, and can carry its own pitch and stereo placement. Results run from a clean time-stretch or pitch-shift of the original to a dense, swirling texture with little of the source left in it.
The whole source buffer is required, not the current frame. From an Audio File node, wire the buffer output rather than waveform.
When to use it
Stretching or compressing a sound in time without changing pitch, or shifting pitch without changing length
Freezing on one instant of a sound and turning it into an evolving pad or drone
Dense, cloud-like or glitchy textures built from tiny slices of a source
Per-grain randomisation: scattering grains across the source, or spreading them across the stereo field
| Parameter | Type | Default |
|---|---|---|
source | OneOf([Signal, NumberArray]) | — |
position | Number | 0.500 |
speed | Number | 0 |
grain_size | Number | 50 |
density | Number | 20 |
pitch | Number | 0 |
spray | Number | 0.100 |
amplitude | Number | 1 |
pan_spread | Number | 0 |
sample_rate | Number | 0 |
max_grains | String | "32" |
window | String | "Hanning" |
Gotchas
Speed of 0 freezes scanning at the current Position, turning a single instant into a sustained texture. Positive and negative values scan forward or backward through the source at that fraction of the source per second.
Spray adds randomness to each grain's source position, so even at Speed 0 there is movement rather than a static loop. Push it toward 1 to pull grains from anywhere across the source.
Source needs the whole buffer, not a single frame. Wired to a waveform output instead of buffer, the node has nothing to slice grains from.
Pan Spread affects the grains output and the separate buffer_right output only. The main mono buffer/output never changes with it. To hear the stereo spread, use buffer and buffer_right together as left and right channels.
Worked example
Add a Granular node and wire an Audio File node's
bufferoutput into Source.Set Position to pick where in the source to granulate, and leave Speed at 0 to freeze there.
Raise Density and lower Grain Size for a smoother texture; do the opposite for a more granular, choppy sound.
Add Spray so grains scatter around Position instead of repeating identically.
Raise Pan Spread and use
bufferandbuffer_rightas left and right channels for a wide stereo texture.
See also
audio.wavetable · Envelope Follower · Additive Synth · Numbers, signals & audio