FX INTRODUCTION / 09 / DRAFT
Noise Gate: close off quiet sounds
Build a gate that opens above a detected level and closes below it.
This article is a work in progress. The examples will be refined through listening. Run starts playback; Stop ends it. Use Apply after editing values. Stop the playing iframe before trying another one.
Listen with the built-in FX
| Setting | Meaning |
|---|---|
| threshold | Threshold based on input amplitude |
| hysteresis | Difference between opening and closing thresholds (dB) |
| attack / hold / release | Opening, closing, and hold times (seconds) |
Select none in FX Monitor to see the waveform after the built-in FX. This pass-through effect makes input and output overlap; it does not compare the signal before and after the built-in FX.
How the PCM is processed
A single threshold can cause repeated opening and closing near that boundary. Use hysteresis with separate opening and closing thresholds, and smooth gain changes. A gate is not source separation: it cannot selectively remove noise occurring alongside loud sounds.
input[ch][i] is one input sample. ch identifies a left or right audio channel, not a physical FM voice. Store values carried between blocks in state. Since process cannot access outer variables, put settings in context.
Try it with liveFx
The 48000 in context.sampleRate is a placeholder. Match it to the actual output rate shown in FX Monitor. It is used to calculate times and frequencies; it does not change the browser's output sample rate.
Open in a separate Playground tab ↗
Select noise-gate-lab in FX Monitor to compare the input and output of this process.
- Compare threshold at 0.005, 0.015, and 0.05. Lower the threshold if the sound disappears.
- During decay, look for where the output becomes quiet earlier than the original.
- Compare short and long releaseMs values.
Scope of this example
The learning example has no Hold, and uses fixed detection and Attack times. The built-in version includes Hold. Thresholds depend on source level, so these values will not suit every sound.
The waveform shows changes over time; Spectrum shows the strength of frequency components. A short display window or smoothing can hide some changes. Listen while changing one setting at a time.