Build with this node

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

Ask Studio

@maruaudio/dsp/dynamics/gate is a soft envelope gate: an absolute-value detector, a one-pole smoothed envelope e = c·e + (1 − c)·|x|, a logistic comparator g = 1 / (1 + exp(−60·(clamp(e) − clamp(threshold)))) with both terms clamped to 0 to 1, and a VCA y = x·g. The envelope is rounded to f32. The smoothing coefficient is exp(−1 / (t·rate)) with the gate's own bounds (t 0.0001 to 2 s, rate 8 to 384 kHz).

const state = initGateNode(48000)
setGateThreshold(state, -50)
const y = gateNodeTick(state, x)

Parameters

SetterRange the setter enforcesDefaultUnit
setGateThreshold−100 to 0, stored as an f32 linear gain−40dB
setGateSmoothing0.005 to 0.50.05s

The logistic steepness is the constant GATE_STEEPNESS (60).

Lifecycle

initGateNode(sampleRate) → setters → gateNodeTick → resetGateNode, which zeroes the envelope and keeps the settings. prepareGateNodeSampleRate re-derives the coefficient from the stored smoothing time without allocating.

When to use it

Quieting the space between notes on a noisy guitar, drum or vocal track. The logistic curve fades the gain around the threshold instead of switching it.

Limits

  • Mono sample tick. One smoothing time serves both opening and closing; there is no hold, range floor or lookahead.
  • The comparator compares linear levels; at the threshold the gain is 0.5.
  • Clamps are the kernel node's conditional clamp, not @maru/math-range.
  • audio-kernels keeps the PCM16 render entries.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Threshold db thresholdDbfloatsetGateThreshold
Smoothing seconds smoothingSecondsfloatsetGateSmoothing

Ports

  • In ininput · audio · mono
  • Out outoutput · audio · mono

One sample per gateNodeTick call.

Dependencies

Dependents

No other node imports this one.

Used by