Build with this node

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

Ask Studio

@maruaudio/dsp/modulation/slew holds the control-smoothing steps that click-sensitive parameters share. The caller owns the current and target values and chooses the response time.

FunctionLaw
onePoleSmoothingCoefficient(t, rate)1 − exp(−1/(t × rate)), f32; t below 0.1 ms uses 0.1 ms, a rate ≤ 0 uses 1
onePoleSmoothingStep(c, target, k)c + (target − c) × k, rounded once to f32
linearTargetStep(c, target, remaining)c + (target − c)/remaining, f32; returns target exactly when remaining ≤ 1
slewLimiterStep(c, target, k, maxStep)The one-pole step with its delta capped to ±maxStep
settlingSlewLimiterStep(c, target, k, maxStep, ε)The capped step, landing on target once the distance fits the cap and the error is below ε or f32 can no longer move

Parameters

There are no setters or state; every value is a function argument.

Lifecycle

Stateless coefficient and step functions. Compute the coefficient when the time or rate changes, call one step per sample, and reset by assigning the current value yourself. Nothing allocates or does I/O.

When to use it

Smoothing a knob or automation value so it does not click, ramping a value in an exact number of samples, or moving a delay read head where the cap stops a large jump from becoming a one-sample discontinuity.

Limits

  • The one-pole step keeps a double intermediate and rounds once. For firmware-exact f32 rounding at every operation, use @maru/modulation-f32-slew.
  • A zero cap holds the value in slewLimiterStep; in settlingSlewLimiterStep a non-positive coefficient or cap holds it.
  • At large f32 magnitudes a cap smaller than one f32 step can leave the value stationary until a representable step or a new target arrives.

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