Build with this node

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

Ask Studio

@maruaudio/dsp/distortion/color-shaper is a wet-only mono transfer in three modes on the input times the drive gain g, each followed by a 10 Hz DC blocker (@maru/filters-dc-block), a one-pole tone filter (@maru/filters-tone) and an output trim. tanh is the exponential form bounded to ±20, and the asymmetric denominator is at least 0.001.

ModeConstantTransfer, with character c
Hard clipCOLOR_SHAPER_HARD_CLIP (0)Clamp to ±(0.1 + 0.9c)
AsymmetricCOLOR_SHAPER_ASYMMETRIC (1)(tanh(x + c/2) − tanh(c/2)) / (tanh(g + c/2) − tanh(c/2))
RectifierCOLOR_SHAPER_RECTIFIER (2)abs(x) when c ≥ 0.5, else max(0, x)

Parameters

configureColorShaper(state, mode, driveDb, character, toneHz, outputDb) uses clampFiniteWithFallback (@maru/math-range); mode is rounded to 0 to 2 (fallback 0).

ArgumentRangeFallbackInit
driveDb0 to 36 dB (@maru/math-decibels)0 dB0 dB
character0 to 1: ceiling, bias or half/full wave01
toneHz500 Hz to min(16 kHz, 0.45 × rate)16 kHz16 kHz
outputDb−24 to +6 dB0 dB0 dB

Lifecycle

initColorShaper(rate) (8 to 384 kHz, fallback 48 kHz) → configureColorShaper → colorShaperTick → resetColorShaper, which clears both filters and keeps the settings. Ticks allocate nothing and do no I/O.

When to use it

Hard clipping, biased saturation or octave-up rectification on drums, bass or synths, with the DC removed.

Limits

  • Mono sample tick, wet only; non-finite input becomes 0.
  • No oversampling: hard edges can alias. Transfers, not tube or tape models.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Ports

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

One sample per colorShaperTick call.

Dependencies

Dependents

Used by