Shaper applies a waveshaping transfer function stored in a wavetable buffer to an audio signal
Waveshaping is a nonlinear distortion technique where every sample of an input signal is remapped through a transfer function. In SuperCollider, Shaper.ar(buf, sig) takes a wavetable buffer containing the transfer function and applies it sample-by-sample to the input signal. The input must be in the range -1 to 1. A linear transfer function produces no effect; a clipping function (saturates at ±1) produces saturation distortion; a sinusoidal transfer function (fold-over) creates inharmonic partials. The transfer function must be in wavetable format (Signal.asWavetable). Chebyshev polynomials as transfer functions are a classic technique for additive partials.
Examples
~tf = Signal.sineFill(1024, [0,1], [0,0]).asWavetable; ~buf = Buffer.loadCollection(s, ~tf); { Shaper.ar(~buf, SinOsc.ar(220)) * 0.2 }.play;
Assessment
What happens if you use a linear transfer function (output = input) with Shaper? What type of transfer function would produce heavy saturation clipping on a sine wave?