Build with this node

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

Ask Studio

@maruaudio/dsp/mixing/gain-db scales one sample by a gain set in decibels, with a mute gate: y = mute ? 0 : x × 10^(dB/20). The decibel conversion is @maru/math-decibels (dbToGain), done in the setter; the per-sample multiply is the same double multiply as @maru/mixing-gain.

const state = initGainDbNode(48000)
setGainDbNodeGainDb(state, -12)
const y = gainDbNodeTick(state, x)

Parameters

SetterRange the setter enforcesDefault
setGainDbNodeGainDb−60 to +24 dB, stored as linear gain0 dB (linear 1)
setGainDbNodeMute0 is off, any other value is onOff

Lifecycle

initGainDbNode → setters → gainDbNodeTick. There is no reset; the state holds only the linear gain and the mute flag. The setter calls pow, so call it when the level changes, not per sample. Ticks allocate nothing and do no I/O.

When to use it

A channel fader or trim set in decibels, or a level control that also needs a hard mute. At −60 dB the gain is 0.001, not silence; use the mute for silence.

Limits

  • Mono sample tick, not a block Processor.
  • Gain and mute changes apply at once, with no smoothing or fade.
  • The clamp is the kernel node's conditional clamp, not the math/range policy: a NaN passes through to dbToGain.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Gain db gainDbfloatsetGainDbNodeGainDb
Mute mutefloatsetGainDbNodeMute

Ports

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

One sample per gainDbNodeTick call.

Dependencies

Dependents

Used by