Remove granulator latency: window+pan the live input (no delay buffer)

The granulators read grains from behind the write head, so each grain
replayed the last grainSize of audio — an audible delay. Rework
StereoGranulator to the straight-through approach (matching Lyrebird's
InputGrain at position 0): grains apply their Hann window and random pan to
the LIVE input sample with no look-back buffer, so there is zero added
latency. Output is normalised by overlap so density doesn't change level.
Drops the circular buffer entirely.

GranulatorPedal / AutoGranulatorPedal are unchanged (same generator API).
Generator tests (seeded determinism, zero-spread centering, full-spread
L/R separation) still hold. Suite 271.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-28 15:49:50 -07:00
parent bc6e6286df
commit a21121e120
3 changed files with 26 additions and 62 deletions
@@ -52,9 +52,6 @@ struct GranulatorPedalTests {
}
}
// Small grains so audible output (which trails the write head by one grain) fills the reader's
// 4096-frame window rather than starting after a long grain's worth of silence.
@Test func buildsAndProducesNonSilentOutput() throws {
let samples: [Float] = try render { pedal in pedal.grain = 0.02 }
#expect(!samples.isEmpty)