Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Filters

Filters shape the frequency content of audio. A quick reference: human hearing spans roughly 20 Hz (low rumble) to 20 kHz (high hiss).

Filtering a single sine wave is uninteresting — it either passes or it doesn’t. Pink noise has energy across the whole spectrum, so filters produce an audible and visible change. Generate some:

sox -n noise.wav synth 5 pinknoise gain -6
play noise.wav

highpass and lowpass

Remove everything below or above a cutoff frequency:

play noise.wav highpass 2000    # remove everything below 2 kHz
play noise.wav lowpass 2000     # remove everything above 2 kHz
play noise.wav highpass 300 lowpass 3400   # telephone band

The telephone band example is a good one to listen to: the characteristic “tinny phone” sound comes entirely from cutting the low and high ends.

bass and treble are shelving variants of equalizer — convenient when you just want to lift or cut one end. See man sox for arguments.

equalizer — parametric EQ

Three arguments: center frequency, width, gain in dB. Width units are controlled by a suffix:

SuffixUnitExample
noneHz200 = 200 Hz wide
qQ factor2q = Q of 2
ooctaves1o = one octave wide

Q and Hz are inversely related: a higher Q means a narrower band. Q = center / bandwidth, so 2q at 1 kHz equals a 500 Hz bandwidth. Q is more useful when you want consistent relative width across different center frequencies.

Stack multiple equalizer effects to build a full EQ:

play noise.wav equalizer 1000 200 -6    # cut 6 dB at 1 kHz, 200 Hz wide
play noise.wav equalizer 1000 2q -6     # same centre, Q=2 (500 Hz wide)
play noise.wav equalizer 3000 1o 3      # boost 3 dB at 3 kHz, one octave wide

A practical voice cleanup chain

⬇ voice.wav (CC0)

sox voice.wav clean.wav \
    highpass 100 \
    equalizer 3000 500 2 \
    norm -3
play clean.wav

Removes low-frequency noise, adds a little presence, normalizes.

sox_ng 14.5+: adds a FIR filter designed from frequency-response knots — you specify points on the desired magnitude response and sox builds the filter. Useful when neither a shelving nor a parametric shape fits what you want. See man sox.