Noise Gate — v1.2 User Guide
Performance‑optimised noise gate with attack, release, hold time, range control, and hysteresis for click‑free gating. v1.2 features a major speed rewrite: gate logic runs at 1000 Hz instead of audio SR (≈44× fewer iterations), with envelope resampled via sinc interpolation.
What this does
Noise Gate v1.2 attenuates a signal when its level falls below a user‑defined threshold. It includes standard studio‑gate features:
- Open threshold – level above which the gate opens (signal passes at full gain).
- Close threshold (hysteresis) – level below which the gate closes (attenuation to
range_dB). Hysteresis prevents chattering. - Attack – time for the gate to open when the threshold is exceeded.
- Hold – minimum time the gate stays open after the signal drops below the close threshold.
- Release – time for the gate to close after the hold period.
- Range – amount of attenuation when closed (‑80 dB = full silence, ‑6 dB = light reduction).
- Sidechain filter – optional high‑pass or band‑pass filter to make the gate respond to specific frequency ranges (e.g., kick drum detection).
- Gate logic now runs at 1000 Hz instead of audio SR. For a 44.1 kHz file, this gives ≈44× fewer loop iterations – the dominant speed‑up.
- Hold loop is O(n) single‑pass counter, not O(n·hold) nested loops.
- Attack/release filtering also runs at 1000 Hz; transitions are refined by sinc interpolation during resample.
- Gate envelope is resampled to audio SR with Praat's built‑in sinc (C‑speed, not scripted).
Quick start
- In Praat, select exactly one Sound object.
- Run script… →
Noise_Gate.praat. - Choose a Preset:
- Gentle (speech), Medium (vocals), Tight (drums), Aggressive (noise removal), Ducker (inverse gate), Tremolo Gate
- For custom mode (preset = Custom), adjust parameters as desired:
- Threshold_dB – level to open the gate.
- Hysteresis_dB – offset below threshold at which the gate closes.
- Attack_ms, Hold_ms, Release_ms – timing.
- Range_dB – attenuation when closed.
- Sidechain_filter – off, HP 100 Hz, HP 200 Hz, or band 1–5 kHz.
- Click OK. The script analyses the sidechain, builds a gate envelope at 1000 Hz, resamples it, applies to the audio, and imports the result as
originalname_gated.
The 6 presets (+ Custom)
| Preset | Threshold (dB) | Hyst (dB) | Attack (ms) | Hold (ms) | Release (ms) | Range (dB) | Description |
|---|---|---|---|---|---|---|---|
| Gentle | -35 | 4 | 2 | 100 | 150 | -40 | Soft, slow gate for speech. |
| Medium | -30 | 3 | 1 | 50 | 80 | -60 | Balanced for vocals. |
| Tight | -25 | 2 | 0.5 | 20 | 30 | -80 | Fast, for drums/percussion. |
| Aggressive | -20 | 2 | 0.3 | 10 | 20 | -80 | Hard noise removal. |
| Ducker | -25 | 3 | 5 | 100 | 200 | -12 | Inverse gate – gentle level drop. |
| Tremolo Gate | -20 | 1 | 1 | 5 | 10 | -80 | Very fast, rhythmic chopping. |
Parameters & defaults
Threshold & hysteresis
| Parameter | Range | Default | Description |
|---|---|---|---|
| Threshold_dB | ‑∞ … 0 | -30 dB | Level above which the gate opens. Measured from the peak intensity of the sidechain. |
| Hysteresis_dB | ≥0 | 3 dB | Gate closes at threshold – hysteresis. Prevents rapid toggling near threshold. |
Timing
| Parameter | Range | Default | Description |
|---|---|---|---|
| Attack_ms | ≥0 | 1 ms | Time for the gate to open fully after threshold is exceeded. |
| Hold_ms | ≥0 | 50 ms | Minimum time the gate stays open after signal drops below close threshold. |
| Release_ms | ≥0 | 50 ms | Time for the gate to close after hold period. |
Range & sidechain
| Parameter | Range | Default | Description |
|---|---|---|---|
| Range_dB | ‑∞ … 0 | -80 dB | Attenuation when gate is closed. -80 dB = full silence, -6 dB = light reduction. |
| Sidechain_filter | Off / HP 100 / HP 200 / Band 1‑5 kHz | Off | Filter applied to the sidechain signal before level detection. Useful for frequency‑dependent gating (e.g., triggering on kick drum). |
Output
| Parameter | Default | Description |
|---|---|---|
| Normalize_output | yes | Scale output peak to 0.95 (‑0.5 dBFS). Disable to preserve absolute levels. |
| Visualize | yes | Show input, gate envelope, and output waveforms. |
| Play | yes | Auto‑play after processing. |
Performance optimisations (v1.2)
⚡ Speed rewrite details
- Gate logic at 1000 Hz: Instead of processing every audio sample (e.g., 44,100 Hz), the envelope is built at 1000 Hz – ≈44× fewer iterations for the state machine, hold, and attack/release loops.
- Hold as O(n) counter: Previously, the hold was implemented with a nested loop scanning
hold_samplesfor each sample – O(n·hold). Now a single counter tracks how many samples remain open, making hold O(n). - Attack/release coefficients: Exponential smoothing at 1000 Hz uses pre‑computed coefficients; the smooth curve is later refined by sinc interpolation during resampling.
- Sinc resampling: The 1000 Hz envelope is upsampled to audio SR using Praat’s built‑in
Resamplewith 50 Hz bandwidth – a C‑level sinc interpolation that is extremely fast and accurate. - Direct intensity lookup: Removed per‑sample
object()interpolation; usesGet value in framefor direct, fast lookup from the Intensity object.
For a 10‑second file at 44.1 kHz, processing time drops from several seconds to well under one second.
Visualization (Praat picture)
When Visualize = 1, the script draws:
- Input waveform (grey).
- Gate envelope (green) with the closed range shaded light red and full‑open region shaded light green. A horizontal dashed line at 0.5 is for reference.
- Output waveform (blue).
- Parameter summary – attack, hold, release, range, and gate open percentage.
range_lin). The open percentage is calculated from the mean envelope value.
FAQ / troubleshooting
Check Range_dB: if set to a mild value (e.g., -6 dB), the closed gain is 0.5 (–6 dB), not silence. For full silence, set to -80 dB or lower. Also ensure the sidechain filter is not removing all energy – if the filtered sidechain is near‑zero, the gate may never open.
Increase Hysteresis_dB – a larger offset between open and close thresholds prevents rapid toggling. Also try increasing Hold_ms to keep the gate open longer after the signal drops.
The envelope is built at 1000 Hz and then sinc‑resampled – this should be extremely smooth. If you hear steps, it may be a bug; please report it. The exponential smoothing coefficients (exp(-4.6 / samples)) ensure a 98 % transition in the given time.
The gate activity percentage is computed as (gateMean - range_lin) / (1 - range_lin) × 100. A value of 50 % means the gate was half‑open on average – useful for assessing how much of the signal passed through.
The sidechain is filtered before level detection. For example, to gate based on kick drum, use HP 100 Hz to isolate low frequencies. The filter is applied using Praat’s Filter (pass Hann band) with a 50 Hz transition width.
The Ducker is an inverse gate: it opens when the signal is below threshold and closes when above. This is achieved by setting range_dB to a moderate value (‑12 dB) and using the same logic – the gate still opens above threshold, but because the range is small, the effect is a gentle level drop rather than silence.