builtins

Distortion

Distortion effects add harmonic content by clipping, saturating, or otherwise mangling signals.

Distortion effects add harmonic content by clipping, saturating, or otherwise mangling signals.

saturate

Tanh Saturation - Smooth hyperbolic tangent waveshaping with drive control.

ParamTypeDefaultDescription
insignal-Input signal
drivenumber2.0Drive amount (1-10+)

Aliases: distort

Warm, tube-like saturation that adds odd harmonics while preventing harsh clipping. Higher drive values increase saturation intensity.

Note: For pure math tanh(x) (hyperbolic tangent), see Math Functions. The saturate() function wraps tanh with drive control for convenient distortion.

// Warm overdrive
osc("saw", 110) |> saturate(%, 3) |> out(%, %)
// Heavy saturation on bass
osc("saw", 55) |> saturate(%, 8) |> lp(%, 400) |> out(%, %)
// Subtle warming
osc("sin", 220) |> saturate(%, 1.5) |> out(%, %)

Related: softclip, fold, tanh (math)


softclip

Soft Clipping - Polynomial soft clipper with adjustable threshold.

ParamTypeDefaultDescription
insignal-Input signal
threshnumber0.5Clipping threshold (0-1)

Softer than hard clipping, rounds off peaks smoothly. Lower threshold values create more aggressive distortion.

// Gentle compression-like softclip
osc("saw", 220) |> softclip(%, 0.7) |> out(%, %)
// Aggressive softclip
osc("sqr", 110) |> softclip(%, 0.2) |> out(%, %)

Related: saturate


bitcrush

Bit Crusher - Reduces bit depth and sample rate.

ParamTypeDefaultDescription
insignal-Input signal
bitsnumber8.0Bit depth (1-16)
ratenumber0.5Sample rate reduction (0-1)

Aliases: crush

Creates lo-fi digital artifacts by quantizing amplitude and reducing sample rate. Lower values create more extreme degradation.

// Classic 8-bit sound
osc("saw", 220) |> bitcrush(%, 8, 0.5) |> out(%, %)
// Extreme lo-fi
osc("saw", 110) |> bitcrush(%, 4, 0.2) |> out(%, %)
// Subtle grit
osc("saw", 440) |> bitcrush(%, 12, 0.8) |> out(%, %)

Related: fold


fold

Wavefolding - Folds signal back on itself when exceeding threshold.

ParamTypeDefaultDescription
insignal-Input signal
threshnumber0.5Folding threshold (0-1)

Aliases: wavefold

Classic West Coast synthesis technique. When the signal exceeds the threshold, it folds back creating complex harmonic spectra.

// Basic wavefold
osc("sin", 110) * 2 |> fold(%, 0.5) |> out(%, %)
// Animated wavefolding
osc("sin", 110) * (1.5 + osc("sin", 0.2)) |> fold(%, 0.4) |> out(%, %)
// Aggressive folding
osc("tri", 55) * 4 |> fold(%, 0.3) |> lp(%, 2000) |> out(%, %)

Related: saturate, softclip


tube

Tube Saturation - Asymmetric waveshaping with even harmonics.

ParamTypeDefaultDescription
insignal-Input signal
drivenumber5.0Drive amount (1-20)
biasnumber0.1Asymmetry bias (0-0.3)

Aliases: valve, triode

Emulates triode tube saturation with an asymmetric transfer function. Unlike symmetric saturators like tanh which produce only odd harmonics, tube adds even harmonics (especially 2nd) for a warmer, vintage character. Uses 2x oversampling internally.

// Warm vintage drive
osc("saw", 110) |> tube(%, 5, 0.1) |> out(%, %)
// Aggressive tube distortion
osc("saw", 55) |> tube(%, 15, 0.2) |> lp(%, 800) |> out(%, %)
// Subtle 2nd harmonic enhancement
osc("sin", 220) |> tube(%, 2, 0.15) |> out(%, %)

Related: saturate, tape


smooth

ADAA Saturation - Alias-free saturation using antiderivative antialiasing.

ParamTypeDefaultDescription
insignal-Input signal
drivenumber5.0Drive amount (1-20)

Aliases: adaa

High-quality tanh saturation with built-in antialiasing. Uses the ADAA (Antiderivative Antialiasing) algorithm to eliminate harsh aliasing artifacts without oversampling. Best for clean, high-fidelity saturation on full mixes or high-frequency content.

// Clean master bus saturation
osc("saw", 220) |> smooth(%, 3) |> out(%, %)
// Heavy saturation without harshness
osc("sqr", 440) |> smooth(%, 10) |> out(%, %)
// High-frequency content stays clean
osc("saw", 880) |> smooth(%, 8) |> out(%, %)

Related: saturate, tube


tape

Tape Saturation - Soft compression with high-frequency warmth.

ParamTypeDefaultDescription
insignal-Input signal
drivenumber3.0Drive amount (1-10)
warmthnumber0.3HF rolloff (0-1)
soft_threshnumber0.5Saturation onset threshold
warmth_scalenumber0.7HF rolloff amount

Emulates magnetic tape characteristics: a wide linear region, soft compression at extremes, and subtle high-frequency rolloff. The warmth parameter controls how much the high frequencies are smoothed. Uses 2x oversampling internally.

The advanced soft_thresh parameter controls where saturation begins (lower = earlier saturation). The warmth_scale parameter controls the intensity of the high-frequency rolloff effect.

// Tape-style glue
osc("saw", 110) |> tape(%, 4, 0.4) |> out(%, %)
// Lo-fi tape warmth
osc("sqr", 220) |> tape(%, 6, 0.8) |> out(%, %)
// Subtle tape coloration
osc("sin", 440) |> tape(%, 2, 0.2) |> out(%, %)
// More aggressive saturation with stronger HF rolloff
osc("saw", 110) |> tape(%, 5, 0.5, 0.3, 0.9) |> out(%, %)

Related: tube, saturate


xfmr

Transformer Saturation - Bass-heavy saturation.

ParamTypeDefaultDescription
insignal-Input signal
drivenumber3.0Drive amount (1-10)
bassnumber5.0Bass saturation (1-10)
bass_freqnumber60.0Bass extraction cutoff (Hz)

Aliases: transformer, console

Emulates transformer/console saturation where bass frequencies saturate more heavily than highs (magnetic core saturation). Creates thick, punchy low-end while keeping highs relatively clean. Great for drums and bass. Uses 2x oversampling internally.

The bass_freq parameter controls the cutoff frequency for bass extraction. Higher values include more of the signal in the bass saturation path.

// Punchy bass
osc("saw", 55) |> xfmr(%, 4, 8) |> out(%, %)
// Console warmth on synths
osc("saw", 220) |> xfmr(%, 3, 4) |> out(%, %)
// Thick transformer saturation
osc("sqr", 110) |> xfmr(%, 5, 6) |> lp(%, 2000) |> out(%, %)
// Extended bass range saturation
osc("saw", 110) |> xfmr(%, 4, 6, 120) |> out(%, %)

Related: tube, tape


excite

Harmonic Exciter - Adds controlled harmonics to high frequencies.

ParamTypeDefaultDescription
insignal-Input signal
amountnumber0.5Exciter intensity (0-1)
freqnumber3000Corner frequency (1000-10000 Hz)
harm_oddnumber0.4Odd harmonic mix (0-1)
harm_evennumber0.6Even harmonic mix (0-1)

Aliases: exciter, aural

Adds harmonic content to frequencies above the corner frequency only, similar to an Aphex Aural Exciter. Creates presence and sparkle without adding low-frequency mud. Uses 2x oversampling internally.

The harm_odd and harm_even parameters control the mix of odd and even harmonics. Even harmonics sound warmer and more musical, while odd harmonics add more edge and presence.

// Add presence to synths
osc("saw", 220) |> excite(%, 0.5, 3000) |> out(%, %)
// Brighten with higher corner
osc("tri", 440) |> excite(%, 0.7, 5000) |> out(%, %)
// Subtle air and sparkle
osc("sin", 110) |> excite(%, 0.3, 4000) |> out(%, %)
// Warmer excitation (more even harmonics)
osc("saw", 220) |> excite(%, 0.5, 3000, 0.2, 0.8) |> out(%, %)

Related: tube, saturate