Skip to content
tuxtone

after the fact

Cleaning noise from files: ffmpeg and SoX at the terminal

Pixel drawing: a cassette of noisy audio pulled through two rollers and coming out as a clean track.

By the TuxTone crew · Updated 2026-09-20 · Tool versions re-verified that day at the projects' own download pages.

Everything else on this site prevents noise from reaching your applications. This page is for the other half of life: the interview you already recorded, the voice memo with a refrigerator in it, the forty lecture captures on a drive with the same hum through all of them. Live suppression cannot help you now. Two terminal tools can — and one of them is in far worse shape than its reputation suggests.

Versions and status, today. ffmpeg 9.0.2 "Lei", released 2026-09-18 — about as actively maintained as software gets. SoX 14.4.2, released 2015-02-22 — the last stable release, over eleven years old; still shipped by every distro, still working, still unmaintained upstream.verified at ffmpeg.org/download.html and the SoX project's release listing · 2026-09-20
age of each tool’s latest release, on 2026-09-20
  1. ffmpeg 9.0.22 daysreleased two days before we checked
  2. SoX 14.4.24,228 daysthe last stable release; finished, not broken
Both still work. Only one of them is still getting fixes.

We lead with that because it's the kind of thing this site exists to say out loud. SoX is not deprecated, not broken, and not dangerous — it is finished, in the way small Unix utilities sometimes are. But if you're choosing where to invest your muscle memory in 2026, ffmpeg is the one getting fixes.

Choose your algorithm before your tool

There are two genuinely different approaches here, and picking wrong wastes an afternoon:

  • Neural, speech-aware (ffmpeg's arnndn). Runs an RNNoise model over the file. Knows what voice sounds like, so it strips complicated noise without needing you to describe it. Best for speech. Terrible for anything you wanted to keep that isn't speech.
  • Spectral subtraction (ffmpeg's afftdn, SoX's noisered). Learns the shape of the noise and subtracts it. Superb against a constant hum, hiss or whine; helpless against a door slam. Needs either a noise sample or a sensible guess from you.

Rule of thumb: a person talking with messy background → arnndn. A steady electrical or mechanical tone under anything → spectral. Both damaged at once → spectral first for the tone, then a light neural pass.

which pass for which noise
  • a person talking over messy backgroundarnndn — neural, speech-aware
  • a steady hum, hiss or whine under anythingafftdn or SoX noisered — spectral
  • both at oncespectral first for the tone, then a light arnndn pass
The rule of thumb above, as a lookup.

ffmpeg: the neural pass

~$ # arnndn needs a model file (.rnnn) — grab one from a
~$ # published RNNoise model collection, then:
~$ ffmpeg -i noisy.wav -af arnndn=m=std.rnnn clean.wav

~$ # blend 70% cleaned with 30% original — gentler, more natural
~$ ffmpeg -i noisy.wav -af \
  >   "arnndn=m=std.rnnn:mix=0.7" clean.wav

That mix parameter is the most underused thing in this whole document. Full-strength neural denoising on an already-compromised recording often sounds worse than a partial one, because the artifacts it introduces are more distracting than the noise it removes. Start at 0.7 and trust your ears.

The model file is the only friction: arnndn does not embed one, so you supply a .rnnn. Several trained models are published openly; they differ in aggressiveness, and trying two on the same thirty-second excerpt takes less time than reading about the difference.

ffmpeg: the spectral pass

~$ # quick, no noise sample needed
~$ ffmpeg -i noisy.wav -af afftdn=nf=-25 clean.wav

~$ # let it track the noise as it changes, and pull harder
~$ ffmpeg -i noisy.wav -af \
  >   "afftdn=nr=12:nf=-30:tn=1" clean.wav

nf is the noise floor in dB — roughly, how quiet you believe the noise is. Too high and you erase your own voice; too low and nothing happens. nr is how many dB to reduce by, and tn=1 enables noise tracking so the filter adapts when the hum changes partway through. If you only remember one line from this page, make it the first one: afftdn=nf=-25 fixes an astonishing share of real recordings.

SoX: profile, then reduce

SoX's approach is the classic two-step, and it's still the most controllable spectral cleanup on the command line. Find half a second where nobody is talking, teach SoX that this is the enemy, then subtract it:

~$ # 1. profile a silent stretch (0.0s to 0.5s here)
~$ sox noisy.wav -n trim 0 0.5 noiseprof room.prof

~$ # 2. subtract it — 0.21 is gentle, 0.3 is assertive
~$ sox noisy.wav clean.wav noisered room.prof 0.21

The quality of the whole operation rests on step one. Profile a stretch with any speech in it and SoX will faithfully remove your voice. Profile a stretch where the noise happens to pause and it will remove nothing. If your recording has no clean noise-only moment, use ffmpeg's afftdn instead — it doesn't require a sample.

On the reduction amount: above roughly 0.3 you enter the land of metallic bubbling artifacts. Under-clean and live with a little noise; it is always less distracting than the sound of over-processing.

Doing it to forty files

~$ mkdir -p cleaned
~$ for f in *.wav; do
  >   ffmpeg -nostdin -i "$f" \
  >     -af "afftdn=nf=-25" "cleaned/$f"
  > done

Two practical notes. -nostdin stops ffmpeg from eating the loop's input and mangling your shell session — leave it out once and you'll never forget it again. And always write to a separate directory: batch-processing in place is how an afternoon of recordings becomes an afternoon of regret. Test your settings on one file first, listen to the whole thing, then run the loop.

Honest limits

  • Clipping is permanent. If the recording was overloaded at capture, the waveform's peaks were never stored. No filter invents them. Fix levels before the next recording.
  • Reverb isn't noise. A tiled bathroom recording stays a tiled bathroom recording.
  • Don't clean twice. Feed these tools the rawest file you have, not one that already passed through live suppression. Layered denoising compounds artifacts rather than cleanliness.
  • Keep the original. Every command here writes a new file for a reason. The best-sounding result usually comes from a second attempt with gentler settings, which requires the first file to still exist.
Money note: ffmpeg and SoX are free software with no affiliate programs, no paid editions and nobody to pay us. We link them because they work — ffmpeg.org (no affiliate relationship). If a site ever tells you a paid app is required to denoise a WAV file on Linux, close the tab.