SoX - Sound eXchange

SoX the sound utility!

Website:http://sox.sourceforge.net/
Category:audio, convert, cmd, nogui

Installation

Note

SoX by default doesn’t have mp3 encoding support, to prevent legal issues with the mp3 patents. Some third pary packages/libraries permits you bypass that problem.

Linux

First check if SoX is avaible on your packagemanager, and check if that version is up to date, if the version is too old; consider download SoX from their website and build it from source.

Ubuntu 12.04

Note

To install sox quick with mp3 support run:
sudo apt-get install sox libsox-fmt-mp3

If you wan’t to install SoX only or know about the extra packages continue reading.

  1. Install using the repository version of SoX:

    sudo apt-get install sox
    
  2. Enable mp3 encoder:

    sudo apt-get install sox libsox-fmt-mp3
    

Mac OS X

SoX can be installed using homebrew, first check the build options with:

brew info sox

The diferents options extends the default behaviour with some extra encoders (conversion formats), check the end of this section to know what are the diferents options.

To build without extensions (without mp3, ogg conversion):

brew install sox

One of the extra encoders is provided by libvorbis, offering encoding file as ogg, to isntall this incoder you must have not installed SoX and run:

brew install sox --with-libvorbis

Usage

SoX is really easy to use, if you know how to use a commandline program. Take a look to the next examples, and you will discover some of the features of SoX.

  1. Play an audio file:

    play filename
    
  2. Convert an mp3 to ogg (the output format is autodected using the new file extension):

    sox filename newfile.ogg
    
  3. Concatenate two or more audio files:

    sox filename1.wav filename2.wav filename3.wav file1to3.wav
    

Advanced usage

  1. Create spectrogram:

    sox casa.mp3 -n spectrogram
    
  2. Tunning spectrogram example params:

    sox casa.mp3 -n spectrogram -Y 130 -l - casa_spec.png
    
  3. Reverse sound track:

    sox casa.mp3 reverse asac.mp3
    

Some interesting resources