Build with this node

Start with a prompt in Studio, or copy it into your own coding agent.

Ask Studio

@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) otherwise

The 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

  • rationalSoftLimit is not bounded: it reaches exactly 1 at |x| = 3, then rises again towards x/9.
  • rationalSoftClip returns exactly ±1 beyond ±3 and propagates NaN.
  • Both are odd functions; the output is f32.
  • No oversampling: a hard input aliases.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Dependencies

None: this node imports no other node.

Dependents

Used by