@maruaudio/dsp/delays/fractional is a bounded f32 delay line read at a fractional position by linear interpolation, y = a + (b − a)·frac, rounded to f32. It has two states. The modulation delay (up to 50 ms) writes the clamped input, then reads, then advances, and mixes dry with delayed. The feedback delay (up to 1000 ms) reads first, in DelayNode order, then writes clamp(x + delayed·feedback, −1, 1) and returns the delayed sample only. Both offer extra read taps, a write without clipping for tap compositions, a first-order allpass tap and a staged clear.
const state = initFractionalFeedbackDelayNode(MAX_PROCESSING_RATE)
prepareFractionalFeedbackDelayNodeSampleRate(state, 48000)
setFractionalFeedbackDelayTime(state, 300)
const wet = fractionalFeedbackDelayNodeTick(state, x)Parameters
| Setter | Range the setter enforces | Default | Unit |
|---|---|---|---|
setFractionalDelayTime | 0 to 50 | 3.5 | ms |
setFractionalDelayMix | 0 to 1 | 1 | linear |
setFractionalFeedbackDelayTime | 0 to 1000 | 250 | ms |
setFractionalFeedbackDelayFeedback | 0 to 0.95 | 0 | linear |
fractionalDelayRead / fractionalFeedbackDelayReadAt (delay argument) | 0 to ring length − 2 | — | samples |
configureFractionalAllpassTap(tap, w, phase) | Coefficient (1 − g)/(1 + g), clamped to 0 to 1; bypass below 1e−10 phase | Bypass | rad |
Lifecycle
Init allocates a ring of the maximum time plus 2 frames at the given rate; pass the highest rate, then prepare for the processing rate. Prepare re-derives the active ring length (within the capacity) and the delay, and clears history only if the length changed. Setters → tick, or the read, write and advance calls → reset, which zeroes the line and index. clear…Step(state, cursor, budget) zeroes at most 256 samples per call and returns line.length when done; then call finalize…Clear.
When to use it
Chorus, flanger and vibrato taps that move smoothly (the modulation state), or a tunable echo with feedback. The allpass tap tunes a fixed feedback loop, such as a string model, at unit magnitude.
Limits
Nonfinite delay-time edits and invalid preparation rates leave the previous configuration intact. A direct read with a nonfinite delay returns silence. Ring wrap also handles the floating-point case where adding the ring length to a tiny negative position rounds exactly to the ring end.
- Mono. Linear interpolation attenuates high frequencies at fractional delays.
- The allpass tap is for a fixed delay: configure and reset it before a note.
fractionalFeedbackDelayWriteAdvancedoes not clip; pass finite audio.