Interface WaveshaperOptions

Construction-time configuration for a WaveshaperEffect, mirroring the waveshaper AudioWorkletProcessor's AudioParam set (see import('./processors/waveshaper').WaveshaperWorkletProcessor). All fields are optional; the worklet clamps to its documented ranges downstream.

The effect is an antialiased distortion/waveshaper using first-order Antiderivative Antialiasing (Parker, Zavalishin & Le Bivic 2016, DAFx-16): y[n] = (F0(x_n) - F0(x_{n-1})) / (x_n - x_{n-1}) (eq.9), with an f(midpoint) fallback at the 0/0 singularity (eq.10). It carries an inherent 0.5-sample group delay (first-order ADAA, eq.17).

interface WaveshaperOptions {
    drive?: number;
    mix?: number;
    output?: number;
    shape?: number | "hardclip" | "tanh";
}

Properties

drive?: number

Pre-gain (drive) into the nonlinearity. Default 1. Range 0..100; >1 = harder saturation.

mix?: number

Wet/dry mix (0..1); 0 = dry bypass, 1 = fully shaped. Default 1.

output?: number

Post-nonlinearity output gain (linear). Default 1. Range 0..4.

shape?: number | "hardclip" | "tanh"

Nonlinearity: 0 = hard clip (polynomial F0, eq.25), 1 = tanh soft clip (F0 = log cosh, eq.20). Default 0. Accepts either the integer index or the matching string alias ("hardclip" = 0, "tanh" = 1), translated to the index in build().