Wave Shaper Distortion — User Guide

A Praat AudioTools waveshaping processor with 12 nonlinear transfer functions, five processing modes, optional wet-path oversampling, dry/wet mixing, normalization, and visualization.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.5 (2026) License: MIT License Repo: https://github.com/ShaiCohen-ops/Praat-plugin_AudioTools
Contents:

What this does

The script processes exactly one selected Sound object. It first creates a wet copy, optionally resamples that wet path to a higher sample rate, applies one of 12 memoryless nonlinear transfer functions through one of five routing modes, returns the wet path to the source sample rate, mixes it with the original dry signal, and optionally peak-normalizes the final result.

Drive is applied before the selected transfer function. Some processing modes alter that routing: Frequency Split uses a stronger drive on the high band, Multi-Stage distributes the requested drive across three cascaded stages, and Stereo Wide applies different drive amounts to Mid and Side.

Quick start

  1. In Praat, select exactly one Sound object.
  2. Run script…Wave Shaper Distortion.praat.
  3. Choose a waveshaping Shape, set Drive, Mix_percent, Oversample, and a processing Mode.
  4. Choose whether to normalize, draw the visualization, and play the result, then click OK.

Parameters (form fields)

Name (GUI)TypeDefaultImplemented behavior
Shapechoice1. Hyperbolic Tangent (soft)Selects one of the 12 transfer functions listed below.
Drivepositive2.0Must be greater than zero. It multiplies the signal before waveshaping, with mode-specific variations described below.
Mix_percentreal80Wet percentage. Values below 0 or above 100 are rejected. Dry level is 1 - Mix/100.
Oversampleinteger41 = off. Values below 1 are clamped to 1; values above 8 are clamped to 8. 2 is explicitly rejected. Values 3–8 are supported.
ModeoptionmenuStandardSelects Standard, Frequency Split (800 Hz), Asymmetric, Multi-Stage, or Stereo Wide (M/S).
NormalizebooleanonAfter dry/wet mixing, scales a non-silent result to peak 0.95. Near-silent output (peak ≤ 1e-9) is left unchanged.
Draw_visualizationbooleanonDraws the diagnostic/transfer visualization in the Picture window.
Play_resultbooleanonPlays the final Sound after processing.

Waveshaping algorithms

For the nominal Standard-mode transfer, let u = Drive × x. The script applies the following functions sample by sample:

#GUI nameImplemented transfer function
1Hyperbolic Tangent (soft)tanh(1.5u) / 1.5
2Sine Fold (warm)0.85 × sin(2.5u)
3Arc Tangent (smooth)2 × atan(1.8u) / π
4Polynomial (aggressive)u - 0.33u³
5Absolute Value (digital)|u| (full-wave rectification)
6Square Law (fuzzy)0.8 × u × |u|
7Chebyshev (harmonic)0.7u + 0.2(2u² - 1) + 0.1(4u³ - 3u) + 0.2. The final offset makes f(0)=0.
8Sigmoid (tube-like)2 / (1 + exp(-2u)) - 1
9Exponential SaturatorFor u ≥ 0: (1-exp(-2u)) / (1+exp(-2u)+0.1exp(-u)); for u < 0, the sign-reversed counterpart using positive exponents.
10Bitcrush (lo-fi)floor(16u + 0.5) / 16. This is amplitude quantization in 1/16 steps; it does not reduce the sample rate.
11Single Wave Wrapu while |u| ≤ 1; otherwise -sign(u) × (2 - |u|). This is the script's single-fold mapping, not a periodic modulo wrap.
12Diode Ladder (analog)Positive samples: 0.5 × (1-exp(-2u)); negative samples: 0.3 × (exp(2u)-1).

Processing modes

ModeImplemented processing
StandardMultiplies the wet signal by Drive, then applies the selected transfer function.
Frequency Split (800 Hz)Creates a low band with Filter (pass Hann band): 20, 800, 100 and a high band with Filter (pass Hann band): 800, source Nyquist, 100. The low band is shaped at Drive; the high band at 1.5 × Drive; the two shaped bands are then summed.
Asymmetric (+/- different)Runs the Standard waveshaper, then multiplies positive output samples by 1.3 and negative output samples by 0.8.
Multi-Stage (3x cascade)Sets stageDrive = Drive^(1/3), then performs three consecutive stages of multiply by stageDrive → waveshape.
Stereo Wide (M/S)For stereo input, forms M=(L+R)/2 and S=(L-R)/2. Mid is shaped at Drive; Side at 1.5 × Drive; output is reconstructed as L=M+S, R=M-S. Mono input falls back to Standard. Input with more than two channels is rejected in this mode.

Signal flow & channel handling

Wet path: source copy → optional oversampling → selected mode / waveshaper → return to source sample rate → dry/wet mix → optional peak normalization.

Oversampling

If Oversample is greater than 1, only the wet copy is resampled to source sample rate × Oversample before nonlinear processing. After shaping it is resampled back to the original sample rate with Praat's Resample command (precision 50), then extracted to the source start/end time so the original time domain is restored before mixing. The dry source itself is never oversampled.

Oversample = 2 is deliberately disabled by the script because its documented Praat 6.1.38 round trip produced frequency-dependent phase shifts. The default is 4×.

Dry/wet mix and normalization

When Mix_percent is below 100, the final pre-normalization signal is wet × Mix/100 + original × (1-Mix/100). At 100%, no dry signal is added.

Normalization occurs after this mix. Therefore, with Normalize enabled, even Mix_percent = 0 can change the source level: the all-dry result is still scaled to peak 0.95 unless it is near-silent.

Channels

Standard, Frequency Split, Asymmetric, and Multi-Stage operate on the selected Sound without reducing its channel count. Stereo Wide accepts mono or stereo only: mono uses the Standard fallback, stereo uses the M/S path, and input with more than two channels stops with an error.

Visualization

When Draw_visualization is on, the Picture window shows:

The transfer-curve panel intentionally shows only the nominal waveshaper. It does not fold Frequency Split or M/S routing, asymmetric post-gain, Multi-Stage cascading, oversampling/downsampling, dry/wet mixing, or final normalization into the curve.

Outputs