Installing SoX in Ubuntu 12.04 and working with ogg and vorbis formats

This topic a bit out of focus of web development, but its more for the opensouce folks out here.. like us. SoX or Sound eXchange is a cross platform swiss army knife of sound processing. You can do a lot of stuff with sound files using SoX including convertion of various formats of computer audio files in to other formats, apply various effects to these sound files, and, as an added bonus, SoX can play and record audio files.

This is what the ubuntu manual has to say about SoX

SoX reads and writes audio files in most popular formats and can
optionally apply effects to them; it can combine multiple input
sources, synthesise audio, and, on many systems, act as a general
purpose audio player or a multi-track audio recorder.

A simple install of SoX from the ubuntu terminal doesn’t work with .ogg and .ogg-vorbis files. You have to do it manually. If you don’t need ogg and vorbis support, you can use the following command in terminal to install SoX.

sudo apt-get install libasound2-plugins libasound2-python libsox-fmt-all
sudo apt-get install sox

But this method will not give you support for ogg ond other open source sound formats vorbis. We will compile SoX from source here. We will need basic tools like make and g++ installed. If you dont have them, install them with,

sudo apt-get install g++ make

Lets install vorbis-tools first

sudo apt-get install vorbis-tools

We will also need libogg and libvorbis libraries from Xiph.Org
First lets install libogg, libvorbis needs libogg to be installed.

cd /tmp && wget -O libogg-1.3.0.tar.gz
tar zxvf libogg-1.3.0.tar.gz && cd libogg-1.3.0
./configure && make
sudo make install

Now lets install libvorbis

 cd /tmp && wget -O libvorbis-1.3.3.tar.gz
tar zxvf libvorbis-1.3.3.tar.gz && cd libvorbis-1.3.3
./configure && make
sudo make install

Lets install some additional libraries for SoX to be prefect,

sudo apt-get install libasound2-plugins libasound2-python libsox-fmt-all

Now lets install SoX into Ubuntu. We will be compling the SoX from source.

cd ~/ && mkdir sox
tar xvzf download
cd sox-14.4.0
make -s && make install

Now you will have to add /usr/local/lib to /etc/ and then run /sbin/ldconfig

sudo vi /etc/

Add this new line include /usr/local/lib at the end

Well.. thats all.. You will now have SoX running from your terminal now.


  • johntvonachen

    Libogg failed to ‘make’ on my Ubuntu system:

    /bin/bash ../libtool –tag=CC –mode=link gcc -O20 -Wall -ffast-math -fsigned-char -g -O2 -no-undefined -version-info 8:0:8 -o -rpath /usr/local/lib framing.lo bitwise.lo
    ../libtool: eval: line 6432: unexpected EOF while looking for matching `”
    ../libtool: eval: line 6433: syntax error: unexpected end of file
    make[2]: *** [] Error 2
    make[2]: Leaving directory `/tmp/libogg-1.3.0/src’
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/tmp/libogg-1.3.0′
    make: *** [all] Error 2

    No one else on the 3W seems to have the same problem I am having.

    • manuchandraprasad

      Seems like an issue with the libogg source. Why dont you try using the new libogg.1.3.3.

      cd /tmp && wget -O libvorbis-1.3.3.tar.gz

      tar zxvf libvorbis-1.3.3.tar.gz && cd libvorbis-1.3.3

      ./configure && make

      sudo make install

      And let me know if this worked, so that i can update the post again.

  • Pingback: I need a few minutes of dedicated server a week, but not for hosting, just to convert ogg etc [closed] - Just just easy answers()

  • Alfredo Levy

    Very nice explanation! do you know how can I install sox with support for m4a format?