@maruaudio/dsp/modulation/f32-slew reproduces two firmware control slews with every subtraction, product and sum rounded to f32, so a long run tracks the firmware bit for bit.
| Function | Law | Upstream |
|---|---|---|
f32OnePoleStep(c, target, k) | c += k × (target − c) | DaisySP fonepole |
f32AsymmetricSlewStep(c, target, rise, fall) | The same with rise when the error is positive, fall otherwise | stmlib SLOPE |
Parameters
There are no setters or state. The coefficient is a per-sample fraction, not a time; the target and coefficients are rounded to f32 before use.
Lifecycle
Stateless step functions, one call per sample; the caller owns the current value, the target and reset. Nothing allocates or does I/O.
When to use it
Ported firmware whose control smoothing must match the device exactly, as the CHOMPI firmware smooths its controls at audio rate. For new code that only needs a smooth control, @maru/modulation-slew rounds once per step.
Limits
- A small coefficient stalls short of the target once f32 cannot move:
fonepole(0.0002)never reaches 1 from 0. - The fall coefficient applies when the error is zero or NaN; a NaN target gives NaN.