Listen
// "Local Forecast" by Kevin MacLeod (incompetech.com), CC BY 4.0, incompetech.com/music/royalty-free/faq.html
audio('/samples/music/modern/local-forecast.mp3').gate()
// "Local Forecast" by Kevin MacLeod (incompetech.com), CC BY 4.0, incompetech.com/music/royalty-free/faq.html
Parameters
threshold- −40 dB
- −80 to 0 dB
closeThreshold- −46 dB
- −90 to 0 dB
range- −60 dB
- −90 to 0 dB
hold- 10 ms
- 0 to 500 ms
attack- 0.1 ms
- 0.01 to 100 ms
release- 100 ms
- 1 to 1000 ms
lookaheadfixed- 0 ms
- 0 to 50 ms
link- 0
- 0 to 1
import gate from '@audio/dynamics-gate'
Noise gate with hysteresis, hold-then-close logic and look-ahead. Opens above threshold, closes only below closeThreshold (hysteresis prevents chatter around a single threshold); below it, signal is attenuated by range dB. A hold timer keeps the gate open after a drop-out; attack/release smooth the gain transitions. lookahead runs detection ahead of emission so the gate is already opening when a transient reaches the output — batch calls stay sample-aligned (no silence prefix, no dropped tail); block hosts get the delay declared as atom latency.
import gate from '@audio/dynamics-gate'
gate(data, { threshold: -40 })
gate(data, { threshold: -35, range: -80, hold: 20, attack: 1, release: 150, lookahead: 5 })
| Param | Default | |
|---|---|---|
threshold |
-40 |
dB, open above |
closeThreshold |
threshold − 6 |
dB, close below (hysteresis) |
range |
-60 |
dB attenuation when closed |
hold |
10 |
ms |
attack |
0.1 |
ms (opening) |
release |
100 |
ms (closing) |
lookahead |
0 |
ms, detection leads emission |
Use when: drum mics, voice dialogue with ambient noise, removing hiss between phrases.
Not for: subtle low-level reduction — use expander.
Part of @audio/dynamics — the dynamics family umbrella. This README is generated from the umbrella docs.
MIT © audiojs