@maruaudio/dsp/modulation/chorus is a mono chorus: a sine-modulated fractional delay over @maru/delays-fractional, with optional regeneration and a dry/wet mix.
d = clamp(centre × (1 + depth × sin(2π·phase)), 1, ringLength − 2)
wet = read(d); write(x + wet × feedback)
y = fround(x × (1 − mix) + wet × mix)The tick reads before it writes, so the delay is at least one sample.
Parameters
| Setter | Range the setter enforces | Default |
|---|---|---|
setChorusRate | 0.01 to 20 Hz | 1.5 Hz |
setChorusDepth | 0 to 1 | 0.7 |
setChorusDelay | 1 to 20 ms centre delay | 3.5 ms |
setChorusFeedback | 0 to 0.9 | 0 |
setChorusMix | 0 to 1 | 0.5 |
setChorusPhaseOffset | −180 to 180 degrees, stored as 0 to 1 cycles; also sets the phase | 0° |
Lifecycle
initChorusNode allocates the delay ring once (50 ms plus two frames at the init rate) → prepareChorusNodeSampleRate → setters → chorusNodeTick → resetChorusNode, which clears the line and returns the phase to the offset while keeping parameters. Prepare re-derives the delay inside the allocated capacity and clears the history when the active length changes. clearChorusNodeStep and finalizeChorusNodeClear clear the line in bounded steps for live replacement. Ticks allocate nothing and do no I/O.
When to use it
Thickening a guitar, synth pad or voice. Several mono states with static phase offsets form a phase-locked stereo field; feedback feeds the delayed signal back into the line.
Limits
- Mono sample tick; one state per channel.
- The line stores
x + wet × feedbackclamped to ±1 at f32. - Positive feedback only.
- Parameter changes apply at once; a phase-offset change jumps the phase.