Stereo delay: controls, timing and feedback¶
The teaching delay wraps two prepared ravet_signal::DelayLine instances with four ravet_signal::LinearSmoother values. Its complete source is explained in delay.rs.
Physical controls¶
| ID | Control | Range | Default |
|---|---|---|---|
| 1 | Delay time | 1–2,000 ms | 375 ms |
| 2 | Feedback | 0–0.95 | 0.45 |
| 3 | Wet mix | 0–1 | 0.35 |
| 4 | Dry bypass | Exactly 0 or 1 | 0 |
| 5 | Ping-pong routing | Exactly 0 or 1 | 0 |
set_controls validates the complete five-value patch before committing it. IDs map to array positions by subtracting one. Time, feedback, mix and routing have smoother slots; bypass does not.
One rendered frame¶
Read the input first, duplicating mono into the internal stereo pair and replacing nonfinite samples with zero. Advance each smoother once. Convert time from milliseconds to fractional samples using the prepared sample rate, then read both delay lines before writing either line.
For channel c, write dry[c] + feedback * ((1 - cross) * wet[c] + cross * wet[1 - c]). At cross = 0, each channel feeds itself. At cross = 1, each channel feeds the opposite delayed output. Reading both lines before either write prevents channel order from changing the recurrence.
After writing, advance both rings. Non-bypassed output is (1 - mix) * dry + mix * wet. Bypass outputs dry samples while the internal recurrence continues. Removing bypass can therefore reveal a retained tail.
Preparation and reset¶
Each ring holds two seconds at the configured rate plus interpolation headroom. Allocation occurs in preparation. Time glides for 20 ms; the other smoothed controls use 5 ms. reset clears history and snaps ramps without allocating.
Limits and tests¶
There is no output limiter, tempo synchronization or plug-in export for this example. Finite input still needs headroom. The delay tests check impulse positions, cross-channel repeats, partition-independent automation, bypass-tail retention, late-event rejection and callback heap activity.