@maruaudio/dsp/distortion/rational-soft-clip holds the rational soft limiter and its bounded soft clip as DaisySP extracts them from stmlib, in the source's f32 operation order:
rationalSoftLimit(x) = x (27 + x²) / (27 + 9x²)
rationalSoftClip(x) = −1 for x < −3, 1 for x > 3, rationalSoftLimit(x) otherwiseThe denominator term is computed as (9x)·x, not 9(x·x), as the source writes 9.f * x * x; the two round differently for some inputs.
Parameters
There are no setters or state. The sample is the only argument, rounded to f32 on entry.
Lifecycle
Stateless functions with no preparation. Nothing allocates or does I/O.
When to use it
Saturating a voice sum, a filter or an output stage the way the CHOMPI TAPE firmware does: SoftClip on its voice sum and filter, SoftLimit in its output limiter. The clip suits any signal that must stay within ±1.
Limits
rationalSoftLimitis not bounded: it reaches exactly 1 at |x| = 3, then rises again towards x/9.rationalSoftClipreturns exactly ±1 beyond ±3 and propagates NaN.- Both are odd functions; the output is f32.
- No oversampling: a hard input aliases.