@maruaudio/dsp/delays/alignment delays a signal by an exact whole number of frames, y[n] = x[n − frames], with no clipping, interpolation or feedback. It exists to line up a dry carrier with a parallel path that has latency, such as a lookahead limiter, and keeps over-unity samples intact. The line is a Float32Array, so stored samples round to f32.
const state = initAlignmentDelay(maxFrames) // control thread
prepareAlignmentDelay(state, lookaheadLimiterLatencySamples(2, 48000))
const dry = alignmentDelayTick(state, x)Parameters
There are no setters. The capacity is passed to init and the active length to prepare.
| Call | Accepts | Default | Unit |
|---|---|---|---|
initAlignmentDelay(maximumFrames) | Rounded up, at least 1 | — | frames |
prepareAlignmentDelay(state, frames) | Whole numbers from 0 to the capacity; anything else returns false and changes nothing | 0 (pass-through) | frames |
Lifecycle
initAlignmentDelay allocates the line once → prepareAlignmentDelay validates the length and clears the line → alignmentDelayTick per sample → resetAlignmentDelay, which zeroes the line and position and keeps the length. Prepare and reset belong on the control thread. With 0 frames the tick returns its input unchanged.
When to use it
Keeping a dry/wet mix phase-coherent when the wet path adds a known delay. The Voice Talk module derives its length from its prepared limiter.
Limits
- Mono, whole frames only. The musical
@maru/delays-boundedand@maru/delays-fractionalkeep their own clipping and interpolation laws. - A length change clears the history.