Asymmetric Soft Clipping — User Guide

Static asymmetric tanh waveshaping with independent positive/negative shaping, bias handling, output-level control, and a transfer-function visualization that follows the rendered settings.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.4.1 (2026) License: MIT License Repo: Praat AudioTools
Contents:

What this does

Asymmetric Soft Clipping applies one static nonlinear transfer function to every sample of the selected Sound. The input is first scaled by Drive and shifted by Bias. The sign of that driven-and-biased value chooses either Pos_Shape or Neg_Shape, and the selected branch is passed through tanh(). Output_Gain then scales the shaped signal.

u = x · Drive + Bias shape(u) = Pos_Shape if u ≥ 0 Neg_Shape if u < 0 raw y = tanh(u · shape(u)) · Output_Gain

Because the positive and negative branches can use different slopes, the transfer curve can be asymmetric. Bias provides a second source of asymmetry by shifting the operating point before the branch decision. The result can range from mild saturation to strongly one-sided distortion.

Important distinction: this is a mathematical waveshaper with a tube-style control concept; it is not a physical model of a specific tube, tape machine, amplifier, diode network, or circuit. The Manual fields are intentionally unbounded real values, so experimental settings can go far beyond conventional saturation behavior.

The processing is channel-preserving: mono stays mono, stereo stays stereo, and a multichannel Sound keeps all of its channels. The same transfer parameters are applied independently to every sample in every channel.

Quick start

  1. Select exactly one Sound in Praat.
  2. Run Asymmetric_Soft_Clipping.praat.
  3. Choose a preset, or leave Manual (Use settings below) to use the five shaping fields directly.
  4. Choose a Bias_mode: keep the raw DC offset, compensate the zero-input offset, or remove the final file mean.
  5. Choose an Output_level mode.
  6. Optionally enable Draw_visualization and Play_result.

The result is a copy named <source>_Tube_<preset>, for example voice_Tube_WarmTube. The original Sound is not modified.

The transfer function

1. Drive

Drive multiplies the input before the nonlinear stage. With ordinary positive values, increasing Drive moves more samples into the flatter regions of tanh(), increasing saturation and reducing the local slope at larger amplitudes.

2. Bias and the branch switch

Bias is added before the sign test. Therefore the positive/negative shape is selected from the sign of x·Drive + Bias, not from the sign of the original sample. When Drive is nonzero, the branch boundary occurs at:

x = −Bias / Drive

The visualization marks this point as the sign flip when it lies inside the displayed input range.

3. Positive and negative shape

Pos_Shape and Neg_Shape scale the argument of tanh() on their respective branches. Larger positive values make that branch reach saturation more quickly. Unequal branch values make the static curve asymmetric and can alter the balance of even- and odd-order harmonic components for periodic material.

4. Output gain

Output_Gain is a constant scalar after tanh(). In the raw mode, the asymptotic shaped bounds are therefore approximately ±|Output_Gain|. Later DC or peak-level stages can shift or rescale those bounds.

Digital nonlinearity and aliasing: tanh() is smooth, but it is still nonlinear and generates new harmonics. Harmonics above Nyquist can alias back into the audible band. This script does not oversample internally.

Bias and DC handling

Bias changes both the shape of the transfer curve and its resting output. The script explicitly computes the raw zero-input value:

f(0) = tanh(Bias · shape(Bias)) · Output_Gain

where shape(Bias) is Pos_Shape for non-negative Bias and Neg_Shape for negative Bias.

Bias modeWhat the script doesConsequence
Raw DC-biased (v0.1/v0.2)Uses the raw waveshaper output with no DC correction.Zero input produces f(0), which may be nonzero. Large bias can therefore create a substantial constant offset during silence.
DC-compensated (zero in → zero out)Subtracts the calculated raw f(0) from every output sample.A digital-zero input maps to zero while the curve remains asymmetric. The upper and lower asymptotic bounds are shifted by the same offset.
Remove final meanApplies the waveshaper first, then Praat's Subtract mean to the rendered Sound.The correction depends on the actual source file. It cannot be represented completely by a single static input→output curve.
Extreme Biased Saturation is not a gate. The preset formerly called “Broken/Gated Bias” was renamed because the script contains no threshold, envelope detector, or gating stage. In Raw mode, its strong positive bias can produce a large positive DC value even when the input is silent.

Parameters & presets

Form parameters

ParameterDefaultMeaning
PresetManualManual settings or one of five fixed presets. A preset overrides the five shaping fields below.
Drive2.0Pre-shaper input multiplier.
Bias0.1Offset added before branch selection and tanh().
Pos_Shape1.0Shape coefficient when x·Drive + Bias ≥ 0.
Neg_Shape3.0Shape coefficient when x·Drive + Bias < 0.
Output_Gain0.8Constant scalar applied after tanh(), before the selected Bias/output-level stages.
Bias_modeRaw DC-biasedSelects raw, zero-input-compensated, or final-mean-removed output.
Output_levelPreserve shaped levelPreserve, conditionally attenuate, or normalize the rendered peak.
Draw_visualizationYesDraw the transfer-function diagnostic, parameter report, output waveform, and summary.
Play_resultYesPlay the processed Sound after rendering.

Built-in presets

PresetDriveBiasPosNegOutput gain
Warm Tube Saturation1.50.050.81.20.9
Hard Overdrive5.00.02.02.00.5
Asymmetric Fuzz3.50.35.00.50.6
Extreme Biased Saturation4.00.84.00.50.6
Subtle Warmer1.10.020.50.60.95
Preset scope: presets replace only Drive, Bias, Pos_Shape, Neg_Shape, and Output_Gain. Bias_mode, Output_level, visualization, and playback remain whatever you select in the form.

Experimental Manual values

The five shaping controls are real fields with no enforced numeric bounds. The script permits unusual values and reports several important cases:

Output-level modes

ModeBehavior
Preserve shaped levelNo peak scaling is applied. If the pre-level peak exceeds 1.0, the Info window reports a warning. This mode preserves the magnitude of Output_Gain.
Attenuate to 0.95 only if peak > 0.95If the rendered peak is above 0.95, Praat Scale peak attenuates it to 0.95. If it is already at or below 0.95, nothing changes. This is conditional whole-file scaling, not a dynamic limiter.
Normalize peak to 0.95For a non-silent result, the whole Sound is scaled so its peak becomes 0.95. A zero-peak result is left silent and normalization is skipped safely.
Output_Gain and normalization: normalizing to a fixed peak cancels the magnitude of any nonzero Output_Gain as a loudness control. A negative Output_Gain still reverses polarity. Use Preserve or conditional attenuation when Output_Gain should retain its intended level relationship.

Visualization

The v0.4.1 visualization uses the Praat AudioTools 8-inch page layout and is organized as a diagnostic view of the transformation rather than a generic waveform display.

Transfer function

Plots input from −1.5 to +1.5. The vertical range is measured from the actual curve instead of being clipped to a fixed display limit. The dotted y=x line is the undistorted reference.

Digital full scale

Lines at +1 and −1 are labelled as digital full scale. They are references, not the waveshaper's mathematical ceiling.

Mode-dependent bounds

Raw mode shows symmetric tanh bounds based on |Output_Gain|. DC-compensated mode shows the shifted upper/lower bounds. Final-mean removal intentionally shows no static bound because the offset is source-dependent.

Zero-input / DC report

Raw mode reports raw y(0); DC compensation shows raw y(0) → effective 0; final-mean removal states that the final value depends on the source.

Output waveform

Mono is drawn directly. For two channels, Ch 1 and Ch 2 are overlaid. For more than two channels, only Ch 1/2 are drawn and the panel explicitly states that all output channels are preserved.

Render-aware level scaling

If conditional attenuation or normalization actually scales this render, the transfer curve includes that scalar. Final mean removal is not drawn into the curve because it cannot be described from input amplitude alone.

Processing pipeline

Select exactly one Sound
        ↓
Apply preset values (if chosen)
        ↓
Compute raw zero-input output f(0)
        ↓
Copy source → <source>_Tube_<preset>
        ↓
u = x·Drive + Bias
choose Pos_Shape / Neg_Shape from sign(u)
raw y = tanh(u·shape)·Output_Gain
        ↓
Bias mode:
  Raw              → no correction
  DC-compensated   → subtract f(0)
  Remove final mean→ Subtract mean after shaping
        ↓
Measure pre-level peak
        ↓
Output-level mode:
  Preserve / conditional attenuation / peak normalization
        ↓
Optional visualization → optional playback

Notes & limitations