The command-line moves I reach for when I want to wrangle audio outside a DAW - quick conversions, cleanups, and measurements. Two tools cover almost everything:
- FFmpeg - formats, containers, loudness, pulling audio out of video. (For the video side, see the FFmpeg guide.)
- SoX - “Sound eXchange,” the DSP
swiss-army knife: effects, silence trimming, noise reduction, analysis.
apt install sox.
Rule of thumb: FFmpeg to convert/normalize/extract, SoX for effects and signal processing.
Convert, resample, re-channel
ffmpeg -i in.wav -c:a libmp3lame -q:a 2 out.mp3 # WAV → MP3 (q:a 0 best … 9 worst)
ffmpeg -i in.wav -c:a flac out.flac # lossless FLAC
ffmpeg -i in.mp3 -ar 44100 -ac 2 out.wav # resample to 44.1 kHz, force stereo
sox in.wav -c 1 mono.wav # downmix to monoTrim, join, split
sox in.wav clip.wav trim 10 30 # 30s starting at 0:10
sox a.wav b.wav c.wav joined.wav # concatenate (same format)
# Split a long file at every silence gap into separate files:
sox in.wav out.wav silence 1 0.5 1% 1 0.5 1% : newfile : restartFFmpeg equivalents for cutting/joining live in the FFmpeg guide.
Volume & loudness
sox in.wav out.wav gain -n # peak-normalize to 0 dBFS
sox in.wav out.wav gain -3 # attenuate by 3 dB
ffmpeg -i in.wav -af "volume=1.5" louder.wav # ×1.5 gain
# Broadcast/podcast loudness normalize (EBU R128) - the right way to "make it consistent"
ffmpeg -i in.wav -af loudnorm=I=-16:TP=-1.5:LRA=11 out.wavPeak vs loudness
gain -nmaxes the peak - but two files normalized that way can still feel like very different volumes.loudnormtargets perceived loudness (LUFS), which is what streaming/podcast platforms actually judge you on (−14 to −16 LUFS).
Fades & silence
sox in.wav out.wav fade t 3 0 3 # 3s fade-in, 3s fade-out
sox in.wav out.wav silence 1 0.1 1% reverse silence 1 0.1 1% reverse # trim lead/trail silence
ffmpeg -i in.wav -af silencedetect=n=-30dB:d=0.5 -f null - # find silent spots (prints timestamps)Clean it up - noise reduction (SoX, two passes)
# 1. Profile the noise from a silent/room-tone section (first 0.5s here)
sox in.wav -n trim 0 0.5 noiseprof noise.prof
# 2. Subtract it (0.21 = strength; go gentle or you get underwater artifacts)
sox in.wav clean.wav noisered noise.prof 0.21Pitch & tempo (independently)
sox in.wav out.wav pitch 200 # +200 cents (2 semitones), tempo unchanged
sox in.wav out.wav tempo 1.25 # 25% faster, pitch unchanged
# FFmpeg tempo (0.5–2.0 per stage; chain for more):
ffmpeg -i in.wav -af "atempo=1.5" fast.wavMeasure & inspect
sox in.wav -n stat # peak, RMS, duration, DC offset…
sox in.wav -n stats # dBFS peak/RMS, crest factor
ffmpeg -i in.wav -af volumedetect -f null - # mean/max volume (great before normalizing)
ffprobe -hide_banner in.wav # codec, sample rate, channels, bitrateGenerate & metadata
sox -n tone.wav synth 3 sine 440 # 3s 440 Hz sine (test tones, clicks, silence)
ffmpeg -i in.mp3 -metadata title="Take 3" -metadata artist="Me" -c copy tagged.mp3Notes
- SoX effects chain left→right -
sox in out gain -3 fade t 2 0 2 pitch 100applies gain, then fade, then pitch, in that order. Order matters. - Work in WAV/FLAC while editing, export to MP3/AAC last - every lossy re-encode throws away quality you can’t get back.
- For anything visual (video audio tracks, muxing, subtitles) jump to the FFmpeg guide.