Remove Silence from Audio
Published Updated
Cut quiet gaps from an MP3, WAV or M4A with a threshold from -60 to -10 dB (default -35) and a shortest gap of 200 to 2000 ms (default 700), then save an MP3 at 128 kbps. Every cut leaves 120 ms of padding at each end.
How a gap is found
The audio is cut into 30 ms windows and each window gets a loudness figure in decibels, from its root-mean-square level. A window below the threshold is silent. A run of silent windows becomes a cut if it lasts at least the minimum gap, and 120 ms is given back at each end of the cut.
The test clip had four 1-second bursts at -20 dB with gaps of 400, 900 and 1500 ms between them, 6.8 seconds in all.
What the settings did to that clip
| Noise in the gaps | Threshold | Minimum gap | Cut | Gaps cut |
|---|---|---|---|---|
| -60 dB | -35 dB | 700 ms | 1.89 s | 2 |
| -60 dB | -35 dB | 200 ms | 2.01 s | 3 |
| -60 dB | -35 dB | 1000 ms | 1.23 s | 1 |
| -45 dB | -35 dB | 700 ms | 1.89 s | 2 |
| -45 dB | -50 dB | 700 ms | 0 s | 0 |
| -30 dB | -35 dB | 700 ms | 0 s | 0 |
The threshold has to sit above the noise in the gaps and below the quietest speech.
How wide a gap has to be to be cut
Measured with the tool's own silence code in Node.js 22.23.1, and with the page in Google Chrome 157, Firefox 155 and Playwright's WebKit build (not the Safari app), on generated mono WAVs at 44.1 kHz: a 0.5 second tone at about -20 dB, a gap of exact zeros, and another 0.5 second tone. The threshold was -35 dB. The three browsers gave the same lines.
| Gap in the file | Minimum gap | Cut in Node.js | Cut shown by the browsers | MP3 length decoded back |
|---|---|---|---|---|
| 720 ms | 700 ms | 0 s, 0 gaps | 0 gaps, 0.0 s | 1.752 s |
| 750 ms | 700 ms | 0.48 s, 1 gap | 1 gap, 0.5 s | 1.296 s |
| 900 ms | 700 ms | 0.63 s, 1 gap | 1 gap, 0.6 s | 1.296 s |
| 600 ms | 200 ms | 0.33 s, 1 gap | 1 gap, 0.3 s | 1.296 s |
| 100 ms, then 300 ms | 200 ms | 0.03 s, 1 gap | 1 gap, 0.0 s | 1.896 s |
| 1500 ms | 2000 ms | 0 s, 0 gaps | 0 gaps, 0.0 s | 2.544 s |
A 700 ms minimum needs 24 whole 30 ms windows below the threshold, which is 720 ms, and the windows start at the beginning of the file. A gap that does not line up with them loses the window that holds the end of the tone, so a 720 ms gap is left alone and a 750 ms one is cut. In Node.js, 600, 700 and 720 ms gaps were not cut at the 700 ms setting, and an 800 ms gap lost 0.54 s. The cut is the run of silent windows minus 120 ms at each end: the 750 ms gap had 0.72 s of silent windows and lost 0.48 s.
The output length is a whole number of MP3 frames. At 48 kHz a frame is 24 ms, so the 750 ms case came back as 54 frames, 1.296 s.
What the browsers did with the sample rate
WAV files of 8, 22.05, 44.1, 48 and 96 kHz, each a 1 second mono tone, were decoded by the browser to 48,000 samples at 48,000 Hz in Chrome 157, Firefox 155 and the WebKit build. The Web Audio standard says decodeAudioData resamples the decoded audio to the sample rate of the context when the two differ. Every file then came out as an MPEG-1 Layer III MP3 at 48 kHz and 128 kbps, mono, 43 frames and 16,512 bytes, which decodes back to 1.032 seconds, in all three browsers.
In each browser the 900 ms gap file gave a 20,736 byte MP3. In Node.js, a clip with a tone in the left channel for one second and then in the right gave one kept range of 2 seconds, because the louder channel decides each window; the left channel alone gave the ranges 0 to 1.14 and 1.88 to 2.
Trimming a recording
Step 1
Add the audio file
MP3, WAV or M4A. The whole file is decoded in memory first, and its length and size are shown.
Step 2
Set the two sliders
Threshold decides how quiet counts as silence. Minimum gap decides how long a quiet stretch must last. A preview line reports seconds to cut and gaps found before you commit.
Step 3
Remove silence and download
The result is always an MP3 named after your file plus -no-silence. A file that is entirely below the threshold is refused with a message.
What the MP3 step means
Audio is decoded by the browser, which MDN says resamples it to the audio context's rate. Google Chrome 156 here used 48,000 Hz.
- A 30-second stereo test encoded to 480,653 bytes, exactly 128 kbps, in about 1.4 seconds.
- For a video with the same problem, use Remove Silence from Video.
- To join the trimmed files afterwards, Merge Audio Files does that.
Silence removal questions
Why was nothing removed?
Either the quiet parts are louder than the threshold, or they are shorter than the minimum gap. A test clip with room noise at -45 dB lost nothing at a -50 dB threshold, and nothing at a 2000 ms gap setting when its longest gap was 1500 ms.
Why did it eat the ends of quiet speech?
The threshold was above the speech. In the test, speech at -20 dB survived -35 dB, but at -10 dB only 0.24 seconds of 6.8 were kept. Lower the number towards -60.
Why does a 900 ms gap not shrink to zero?
Each cut keeps 120 ms of padding at both ends, to protect the start and end of words. The 900 ms gap lost 660 ms, and the 1500 ms gap lost 1230 ms. The padding is fixed and has no slider.
What if only one stereo channel is silent?
The louder channel decides each 30 ms window, so sound in either one keeps the window. A tone in the left channel for a second and then in the right gave one unbroken kept range.
Why is the output an MP3 from a WAV?
The page only writes MP3, at a fixed 128 kbps. That is about 16 KB per second. Starting from a lossless WAV you get lossy output, and starting from an MP3 you get a second lossy generation.
Is the audio uploaded?
No. The browser decodes it with the Web Audio API and the MP3 is encoded in the page.
Why was a 720 ms gap not cut at a 700 ms setting?
The tool needs 24 whole 30 ms windows below the threshold, which is 720 ms, and the windows start at the beginning of the file. A gap that does not line up with them loses the window that holds the end of the tone. A 720 ms gap was left alone and a 750 ms gap lost 0.48 s.
Does the sample rate of my WAV matter?
No. WAV files at 8, 22.05, 44.1, 48 and 96 kHz all came out as 48 kHz MP3s of identical size, 16,512 bytes for a 1 second clip, in Chrome 157, Firefox 155 and the WebKit build, because each browser first decoded them to the sample rate of its audio context, which was 48 kHz in these runs.
Why is the MP3 a little longer than the audio I kept?
The MP3 is built from whole frames of 24 ms at 48 kHz. A 1 second WAV with nothing cut came back as 43 frames, 1.032 seconds.
Why does the preview say 1 gap but 0.0 s?
A cut shorter than 0.05 s is shown as 0.0 s. A 300 ms gap with a 200 ms minimum has 0.27 s of silent windows, and 240 ms of padding leaves a 0.03 s cut.