SoX – Sound eXchange

Published by

Posted on December 06, 2007

Sox is a general purpose sound converter/player/recorder that supports the following formats:

* RAW sound data in various data styles
* RAW textual sound data
* Amiga 8svx files
* Apple/SGI AIFF files
* SUN .au files
o PCM, U-law, A-law, G7xx ADPCM files
o mutant DEC .au files
o NeXT .snd files body [|More information on SOX]

wget ( this may change , check with the SOx website for correct address)


The preferred method for compiling SoX is to use the “configure” scripts
compatible with most UNIX systems that contain “/bin/sh” or equivalent
(even the Window’s Cygwin setup will work with this).

To compile and install SoX on these platforms run the following commands:

make install

There are several optional parameters that you may pass to the configure
script to customize SoX for your applications. more detailed information with regards to books of ra online. Run “./configure –help”
for a complete list of options.

If your system works with the “configure” script then you may skip
to the Optional Compiling section.

If your system does not work with the configure scripts then there are
several canned “Makefile”‘s that you can use inside the src directory.
The following systems have a canned Makefile:

DOS Makefile.dos (Borland or Turbo C)
WIN95/NT Makefile.dos (Needs modifying for Visual C++)
OS/2 Makefile.gcc (using EMX GCC compiler)

To use a canned Makefile, a few steps need to be completed. First up,
you need to make a copy of and call it stconfig.h. Modify
this file to reflect your environment.

FIXME: A file called ststdint.h needs to be created as well. This
is the same as stdint.h if your system has it.

After that, copy either Makefile.dos or Makefile.gcc to a file
called Makefile. This needs to be done in both the src directory
and the src/gsm directory. This file also needs to be modified to reflect
your environment.

Optional Compile Features

A GSM library is included with SoX. More information on this library
can be obtained from
If this library fails to compile on your system, you can specify
–disable-gsm to prevent it from being compiled in.

SoX can make use of Ogg Vorbis libraries to read and write Ogg
Vorbis files. Normally, the configure script will auto detect
this library and enable support for Ogg Vorbis. Ogg Vorbis library
can be obtained from

SoX can make use of MP3 libraries to read and write MP3 files.
Normally, the configure script will auto detect these libraries and
enable support for MP3. SoX requires libmad for reading MP3 files
and lame for writing MP3 files. Libmad can be obtained from and lame can be obtained from

If any libraries are installed in a non-standard locations in your
system then you can use the CPPFLAGS and LDFLAGS variables to allow
configure to find
them. For example:

./configure CPPFLAGS=”-I/home/sox/include -I/usr/local/multimedia/include” LDFLAGS=”-L/home/sox/lib -L/usr/local/multimedia/lib”

If you’re not processing lots of u-law or A-law files and would
like to save around 64K of memory when SoX is executed then you
can use runtime routines to perform u-law/A-law conversions.
This is slower then the default lookup tables but results in the
same answers. To save this memory, specify –disable-fast-ulaw and


After successfully compiling SoX, try translating a sound file.
If you can play one of the supported sound file formats,
translate ‘monkey.wav’ to your format (we’ll use ‘xxx’):

cd src
./sox monkey.wav

You may have to give the word size and rate for the file.
For example, this command will make a sound file with a data rate of
12,500 samples per second and the data formatted as signed shorts:

./sox monkey.voc -r 12500 -s -w

If plays properly (it’s a very short monkey screech),
congratulations! SoX works.

After that, running “” and “” (“tests.bat” and
“testall.bat” for DOS) tests most of the implemented file handlers to
make sure that some portability issue haven’t popped up.