Using sox from the Command Line

Trim Flies


Slice an Audio File

Slice the parts of source.wav into output.wav starting at 3.456 seconds into the file for a duration of 9.876 seconds.

sox source.wav ouptut.wav trim 3.456 9.876

Generate Empty Audio Files (Padding)

This will generate a file pad0.wav that is 3.456 seconds long

sox -n -r 16000 pad0.wav trim 0.0 3.456

Concatinate Audio Files

Pack all these files together

sox -q file0.wav pad0.wav file1.wav -b 16 -c 1 -e signed -r 16000 -L -t wav output.wav

Convert WAV to MP3

Sox doesn't do this, you can use ffmpeg to make this conversion.

See Also