@maruaudio/dsp/delays/primitives holds the three stateless operations the chain's fixed delay performs, shared with @maru/delays-feedback and @maru/delays-bounded so they cannot diverge:
delayFrameCount(ms, rate):max(1, round(ms·rate/1000))whole frames.delayDryWetMix(dry, delayed, mix):dry·(1 − mix) + delayed·mix.delayFeedbackWrite(dry, delayed, feedback):clamp(dry + delayed·feedback, −1, 1), the value to store back into the line.
const frames = delayFrameCount(250, 48000) // 12000
const y = delayDryWetMix(x, line[i], 0.5)
line[i] = delayFeedbackWrite(x, line[i], 0.4) // Float32Array storeParameters
This DSP node has no setters or state; every value is passed to the function. None of the three clamps its mix or feedback argument; the write clamps its result to −1 to 1.
Lifecycle
There is no instance state. The caller owns the delay line, its index and its reset. Call delayFrameCount when time or rate changes, and the mix and write once per sample.
When to use it
Building a fixed echo, slapback or simple feedback delay that must match the chain's arithmetic byte for byte.
Limits
- Double-precision arithmetic; f32 quantization happens only in the caller's
Float32Arraystore. - The write clamp is a conditional clamp, not
@maru/math-range, so a NaN passes through it. - Whole-frame lengths only; fractional delays belong to
@maru/delays-fractional.