Voice recordings are rarely at a constant level. The speaker leans in, leans back, gets excited, gets quiet — the result is a file that is hard to listen to at a fixed volume. The `acompressor` filter is a one-knob compressor that smooths the dynamic range in real time, lifting quiet sections and softening loud ones.

The command

ffmpeg -i in.wav -af "acompressor=threshold=-20dB:ratio=4:attack=20:release=1000" out.wav

What it does

The filter watches the audio level, and when it crosses the threshold, it reduces the gain by the ratio. A threshold of -20 dB with a ratio of 4:1 means a signal at -10 dB (10 dB above the threshold) is reduced to -15 dB (5 dB above the threshold). The attack and release times control how fast the compressor engages and disengages, in milliseconds. The output is a file with a more even level, ready for a final limiter.

Requirements

Any audio input. The filter is in libavfilter. CPU-only, single-pass. The default values are reasonable for spoken voice; for music, raise the attack to 50 ms to preserve the transient of a drum hit.

Things to avoid

  • Setting a very high ratio (10:1 or higher) without a makeup gain. A heavy ratio flattens the dynamic range; the file will sound compressed, not just even.
  • Using a very fast attack. The compressor will catch every transient and squash it; raise the attack to let the first few milliseconds of each word through.
  • Compressing a file that is already normalized. A normalized file is at a fixed level; compression will just bring it down, not even it out.
  • Replacing a multi-band compressor. A single-band compressor cannot tame a bass-heavy voice and a sibilant 's' at the same time. For broadcast-quality voice, use a chain of high-pass, de-esser, and compressor.