Audio manipulation with SoX
SoX (Sound eXchange) calls itself “the Swiss Army knife of sound processing programs” and offers, apart from standard audio format and sample rate conversion, a basic set of effects (e.g. pitch shifting, reverb, low pass filtering, flanger, etc). It’s available for Linux (search for ‘sox’ in your package manager), Mac OS X and Windows.
Minimal conversion example
sox input.mp3 output.wav
Convert to mono (two possibilities: by specifying output format
or with the ‘channels’ effect.
sox input.mp3 -c 1 output.wav sox input.mp3 output.wav channels 1
Change sample rate (again two possibilities)
sox input.mp3 -r 8000 output.wav sox input.mp3 output.wav rate 8000
Newer versions of SoX also support
sox input.mp3 output.wav rate 8k
Trim a fragment of 30 seconds at an offset of 60 seconds
with the ‘trim’ effect
sox input.mp3 output.wav trim 60 30
All together now (trimmed fragment in mono, 22.05 Hz sample rate)
sox input.mp3 output.wav trim 60 30 channels 1 rate 22050
source code
https://sourceforge.net/projects/sox/files/sox/