Engine

How a recording becomes grains, and how they fall.

Signal path

Inputmono, DC blockRing31 sBuffers2 × 30 sGrains32 voicesLevelnormaliserFilterSVFReverbReverbScMixdry and wetLimiter−0.5 dBFSOutputstereoP10The input: Mix P11 + S36, Listen P11 + P10

Both jacks are summed to mono, −3 dB each. The ring takes the input all the time. P10 copies from it into the buffer not playing, and the grains read the buffer playing.

Recording

S30S351234567playhead, S36Spray, S31recordingslices, P03–P09
  1. TapUnder 0.3 s: the 8 s before it.
  2. HoldFrom 50 ms before the touch to the release, up to 30 s.
  3. TrimSilence under −60 dBFS cut from both ends.
  4. LandCopied at 8×. Over 2 s new grains read it with rising odds.
  5. SlicesThe loop's start and its 6 strongest attacks, in 5 ms frames. Too few: even parts.

A grain

  1. PositionThe playhead. With Spray, evenly round it, up to the loop.
  2. StartUp to 5.3 ms or ¼ its length, in phase with the grain before (WSOLA). Off with Spray.
  3. ReadFour-point Hermite, as Beads. Rate 2^(n/12), ±24 semitones.
  4. ShimmerUp: free, to ±12 semitones. Down: octaves, up to 2 grains in 3.
  5. Size5 ms to 2 s, 100 ms at the centre. Grit: part way to any.
  6. WindowBeads' envelope along Shape. Flux: part way to any. At least 0.5 ms up, 10 ms down.
  7. PanSpread places each grain, from the centre to anywhere across. Equal power.
  8. DirectionThe playhead's.
squaredecaybellreverse

Starts

2/s20/s320/s

Density is grains a second, 0.25 to 320, none at the bottom, whatever their size: grains sounding at once are Density × Size. Jitter takes the starts from a regular pulse to nearly Poisson, the same mean. 32 voices: when all sound, a new grain is dropped.

Level

in phaseamplitudes addscatteredpowers add

Grains in phase add in amplitude, scattered ones in power. A normaliser measures both every block, 5 ms smoothed, and brings the sum to the input's level with 0.9 headroom, never boosting grains that cancel. Aligned starts keep slowed grains in phase: at ½× a sawtooth's harmonics vary 0.27 dB from one 20 ms frame to the next, as at 1×. Without, 1.0 dB, and 5.4 dB in a dense random cloud.

Transport

  1. Speed0 to 4×, the pitch kept. Frozen, a full stroke scrubs the loop.
  2. EndS07 at the loop's end: stop, turn back, or round again.
  3. StopP00 held: a tape stop over 0.6 s. Released: back to speed.
  4. TriggerP02: from the loop's start (end in reverse), a grain at once.
  5. SlicesP03–P09 held: each slice its own playhead, the loop waiting.

Effects

  1. FilterSVF: low-pass to 200 Hz, off at the centre, high-pass to 2 kHz.
  2. ReverbReverbSc on the grains. Decay 0.5 to 16 s, up to half wet.
  3. MixP11 + S36: the input against the grains, equal power. Grains alone at the top.
  4. ListenP11 + P10: the input alone, 1 s to dry, 0.5 s back. P11 let go: recording, still dry.
  5. LimiterLook-ahead 5 ms, −0.5 dBFS, after the mix.

Runtime

  1. Audio48 kHz, 48-sample blocks: 1 ms. Recordings in SDRAM, mono.
  2. CPU15 % with no grains. 83 % at most: 32 voices, Pitch +24.
  3. BrowserThe same C++ core in WebAssembly, in an AudioWorklet.