Amplitude-Following Wah-Wah — User Guide

An offline envelope-controlled resonant filter: the source amplitude is tracked with separate attack and release times, mapped over a fixed dB range, and used to move the filter centre between a low and high frequency.

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

What this does

Amplitude-Following Wah-Wah creates a wah-like resonant-filter movement directly from the dynamics of the selected Sound. Louder regions move the filter centre upward; quieter regions move it downward. The motion is controlled by an attack/release envelope follower rather than by frame-wise file min/max normalization.

Signal flow:
selected Sound → channel-safe amplitude estimate → attack/release follower → peak-relative dB mapping → time-varying FormantGrid centre frequency → resonant filtering → dry/wet mix → optional attenuation-only safety stage

The effect is offline: the complete Sound is analyzed and rendered before playback. The resulting filter trajectory is deterministic for a given source and parameter set.

Quick start

  1. Select exactly one Sound object.
  2. Choose one of the four presets or Custom.
  3. Set Attack and Release to control how quickly the wah reacts to rising and falling amplitude.
  4. Set Envelope range to define how many dB below the observed envelope peak map across the full filter range.
  5. Use Dry/Wet to blend the processed and original signals.
  6. Use Safety peak if you want attenuation-only protection against an excessive output peak.
Starting point: the Classic Guitar preset with 8 ms attack, 80 ms release, 30 dB envelope range, and 100% wet gives a clear amplitude-driven sweep without changing the preset's filter range.

Presets

The preset selects only the filter-frequency range and bandwidth. Envelope, mix, safety, visualization, and playback controls remain user-adjustable.

PresetCentre-frequency rangeBandwidthCharacter
Classic Guitar400–2500 Hz100 HzNarrow mid-range sweep.
Funky Bass80–800 Hz80 HzLow-frequency focused sweep.
Subtle Vocal500–1500 Hz300 HzBroader, gentler resonance.
Sci-Fi Zap200–4000 Hz50 HzVery narrow, wide-range motion.
CustomUser-definedUser-definedUses the three Custom filter fields.

Envelope follower

Channel-safe amplitude input

The envelope analysis is deliberately constructed so opposite-polarity channels cannot cancel. The script squares every real channel first, averages the squared channels when the source is multichannel, and then takes the square root.

mono: envelope input = |x|

multichannel: envelope input = sqrt(mean(x_channel²))

This amplitude-control signal is used only to drive the filter trajectory. The audio that is filtered remains the original Sound with its original channels.

Attack / release smoothing

A one-pole follower is evaluated sample by sample. Rising input uses the attack coefficient; falling input uses the release coefficient.

alphaAttack = exp[-1 / (AttackSeconds × sampleRate)]
alphaRelease = exp[-1 / (ReleaseSeconds × sampleRate)]

if input[n] > env[n-1]:
  env[n] = alphaAttack × env[n-1] + (1-alphaAttack) × input[n]
else:
  env[n] = alphaRelease × env[n-1] + (1-alphaRelease) × input[n]

An Attack or Release value of 0 ms sets the corresponding coefficient to zero, giving immediate response in that direction.

Peak-relative dB mapping

After the follower is built, its maximum value becomes the reference peak. Each control sample is converted to dB relative to that peak:

relative_dB(t) = 20 log10[ envelope(t) / peakEnvelope ]

normalized(t) = clamp((relative_dB(t) + EnvelopeRange_dB) / EnvelopeRange_dB, 0, 1)

centre(t) = minCutoff + (maxCutoff - minCutoff) × normalized(t)

The observed envelope peak therefore maps to the maximum filter frequency. A level exactly Envelope range dB below the peak maps to the minimum frequency. Anything quieter is clamped at the minimum.

Why this matters: a nearly constant source no longer has tiny numerical variations stretched across the entire wah range. The mapping has a fixed acoustic reference: a specified dB span below the actual envelope peak.

If the envelope is effectively silent, the normalized control is 0 and the filter centre stays at the minimum frequency.

Control-point density

The FormantGrid trajectory uses up to 5000 control points. The script aims for approximately 5 ms spacing on ordinary-duration files; when a file is long enough to exceed 5000 points, the points are distributed evenly across the complete duration at a wider spacing.

Filtering and dry/wet mix

A one-formant FormantGrid is created over the exact start and end times of the source. Every control point receives the mapped centre frequency and the selected fixed bandwidth. Praat's FormantGrid Filter command is then applied to the original Sound.

The script does not implement the wah as a separate textbook biquad equation, so the guide does not assign an external transfer-function formula to the filter. The implemented control variables are the FormantGrid centre-frequency trajectory and a fixed bandwidth.

Dry/wet

output = dry × (1 - wetAmount) + filtered × wetAmount

At 100% wet, the processed Sound is copied directly. Between 0 and 100%, dry and filtered samples are linearly mixed channel by channel.

0% wet is an exact bypass. The script copies the original Sound and skips envelope construction, filtering, safety attenuation, and the wah visualization. This guarantees that the bypass path is not altered by any later processing stage.

Parameters

ParameterDefaultImplemented behavior
StyleClassic GuitarSelects one of four fixed filter ranges/bandwidths or Custom.
Custom min Hz400 HzUsed only for Custom; wet processing clamps the effective minimum to at least 20 Hz.
Custom max Hz2500 HzUsed only for Custom; wet processing clamps the effective maximum to 95% of Nyquist.
Custom bandwidth Hz150 HzUsed only for Custom; effective bandwidth is at least 1 Hz and no more than 90% of Nyquist.
Attack ms8 msRise time constant of the one-pole follower; negative entries are clamped to 0.
Release ms80 msFall time constant of the one-pole follower; negative entries are clamped to 0.
Envelope range dB30 dBPeak-relative dB span mapped from minimum to maximum filter centre; clamped to at least 1 dB.
Dry/Wet percent100%Clamped to 0–100%; 0% invokes the exact dry bypass.
Safety peak.99Clamped to 0–1; 0 disables the safety stage. Otherwise only signals above the target are attenuated.
Draw visualizationOnDraws input/output, normalized control, centre-frequency path, and summary when wet processing is active.
Play resultOnPlays the completed result.

Channel, timing, and sample-rate behavior

PropertyBehavior
InputExactly one selected Sound.
Envelope analysisOne channel-safe RMS-like control signal derived from all input channels.
FilteringThe FormantGrid is applied to the original Sound, not to the mono control signal.
Dry/wet mixPerformed channel by channel using the same wet amount.
Channel countPreserved.
Sample ratePreserved.
DurationPreserved.
Start timePreserved; the FormantGrid is built over the source's actual start/end times.

Nyquist-aware validation and safety peak

Filter range

Wet processing enforces:

minimum centre ≥ 20 Hz
maximum centre ≤ 0.95 × Nyquist
maximum centre > minimum centre

If clamping leaves no valid frequency span, the script stops with an error rather than creating an invalid FormantGrid trajectory.

Bandwidth

1 Hz ≤ bandwidth ≤ 0.9 × Nyquist

Safety peak

The safety stage is attenuation only. It measures the absolute output extremum and scales only if that peak exceeds the requested Safety peak.

if outputPeak > SafetyPeak:
  gain = SafetyPeak / outputPeak
  output = output × gain

otherwise: output is unchanged

This is not target peak normalization: quieter results are never boosted.

Visualization

When wet processing is active and Draw visualization is enabled, v0.6 draws four process views plus a summary:

Input

The original waveform.

Output

The final processed waveform after dry/wet mixing and any safety attenuation.

Envelope

The normalized 0–1 control actually used for the dB-to-frequency mapping. A dotted 0.5 reference line is shown.

Centre (Hz)

The actual mapped filter-centre trajectory. Dotted lines mark the effective minimum and maximum frequencies after sample-rate-aware validation.

Summary

Reports the effective range, bandwidth, attack/release, envelope range, wet percentage, safety setting, channel count, and duration.

The plotted envelope and centre-frequency curves use the same control arrays that populate the FormantGrid, so they describe the implemented control path rather than an independent illustration.

Output behavior