Installing SoX w/ MP3 Support on CentOS 5.x

First off, this article assumes you already know the basics of using the yum repositories, downloading & extracting tarballs, and compiling sources on a CentOS 5.x box.

So recently we were given the task of installing the latest version (14.3.0) of SoX (Sound eXchange); on a new CentOS 5.x machine.

The base of CentOS already comes with an older version of SoX (12.18.1), but it doesn’t have mp3 support built into it.  Unfortunately there were no repos out there with the latest version.  With almost every repo available to CentOS, they all reported that the latest available version was installed.

This version was okay, but trying to manipulate MP3s was impossible, and always kick back the error “SoX was compiled without MP3 decoding support”.   So since we were gonna have to rebuild SoX anyway, why not just go with the latest and greatest?

To accomplish installing the latest version with MP3 support, DO NOT uninstall the base version and it pretty much contains all of the dependencies that you will need to compile the source of the latest version.

First off, you are going to need the Lame Encoder. You do not need to download and compile the source code, as you can use the rpm from the repos to install it.

code:
yum install lame

Next, you’re gonna need the MAD: MPeg Audio Decoder source. Note: this project has not been updated since 2004, however it is still the basis of what you need in order to turn on full MP3 support for SoX. You will need to download madplay-05.15.2b, libmad-05.15.1b, and libid3tag-05.15.1b. While there are yum based repos for madplay, libmad, & libid3tag, they will NOT be recognized as being installed by the latest version of the SoX compiler, so you must download these tarballs and compile them manually from scratch.

Install each one of these downloads. The order doesn’t really matter, though for best results, you should start with libmad first, then libid3tag, followed by madplay.

Once you have those three installed, grab the latest version of SoX, unpack it and just run “./configure”, then “make -s”, and finally “make install”. SoX will tell you to run “make -s && make install” together, but might break. Run them separately.

After running the “./configure”, you should see this towards the end of the output:
code:

OPTIONAL FILE FORMATS
amrnb......................no
amrwb......................no
ffmpeg.....................yes
flac.......................no
gsm........................yes (in-tree)
lpc10......................yes (in-tree)
mp3........................yes
id3tag....................yes
lame......................yes
dlopen lame...............no
mad.......................yes
dlopen mad................no
oggvorbis..................yes
sndfile....................no
wavpack....................no

That’s all you need.. to make sure “lame….yes”, “mad….yes”, and “id3tag…yes”, and it will install and run like a champ.

We put this out there because we had a tough time trying to use the repositories to complete this function, and just compiling it all from scratch worked out best.

-nw

This entry was posted on Thursday, January 14th, 2010 at 10:25 pm and is filed under CentOS 5. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Installing SoX w/ MP3 Support on CentOS 5.x”

  1. Arthur Debert Says:

    Thank you for the write up. This has just saved me a world of pain.
    You might want to remember folks to add “/usr/local/lib” to their ld.so.conf files.

    Best regards
    Arthur

Leave a Reply