SoX - Sound eXchange

SoX - Sound eXchange, the Swiss Army knife of audio manipulation.

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.

Few things that can be done with this knife :

The overall SoX processing chain can be summarized as follows:

Input(s) → Balancing → Combiner → Effects → Output

The simple: sox recital.wav translates an audio file in Sun AU format to a Microsoft WAV file.

sox -r 12000 -1 -c 1 recital.wav vol 0.7 dither performs the same format translation, but also changes the audio sampling rate & sample size, down-mixes to mono, and applies the vol and dither effects.

sox -r 8000 -u -1 -c 1 voice-memo.raw voice-memo.wav adds a header to a raw audio file,

sox slow.aiff fixed.aiff speed 1.027 rabbit -c0 adjusts audio speed using the most accurate rabbit algorithm.

sox concatenates two audio files.

sox -m music.mp3 voice.wav mixed.flac mixes together two audio files.

play "The Moonbeams/Greatest/*.ogg" bass +3 plays a collection of audio files whilst applying a bass boosting effect.

play -n -c1 synth sin %-12 sin %-9 sin %-5 sin %-2 fade q 0.1 1 0.1 plays a synthesised ‘A minor seventh’ chord with a pipe-organ sound.

rec -c 2 test.aiff trim 0 10 records 10 seconds of stereo audio.
rec -M take1.aiff take1-dub.aiff records a new track in a multi-track recording

More and still more :

For easy listening of (‘xxx’ is any sound format):
play effect-name effect-parameters

Or more SoX-like (for ‘dsp’ output on a UNIX/Linux computer):
sox -t oss -2 -s /dev/dsp effect-name effect-parameters

or (for ‘au’ output):
sox -t sunau -2 -s /dev/audio effect-name effect-parameters

And for date freaks:
sox file.yyy effect-name effect-parameters


echo can be used to add a second sample shortly after the original one.

This will sound as if you are doubling the number of instruments playing in the same sample:

play echo 0.8 0.88 60 0.4

If the delay is very short, then it sound like a (metallic) robot playing music:

play echo 0.8 0.88 6 0.4

Longer delay will sound like an open air concert in the mountains:

play echo 0.8 0.9 1000 0.3

One mountain more, and:

play echo 0.8 0.9 1000 0.3 1800 0.25


Like the echo effect, echos stand for ‘ECHO in Sequel’, that is thefirst echos takes the input,the second the input and the first echos,the third the input and the first and the second echos, ... and so on.

The sample will be bounced twice in symmetric echos:

play echos 0.8 0.7 700 0.25 700 0.3

The sample will be bounced twice in asymmetric echos:

play echos 0.8 0.7 700 0.25 900 0.3

The sample will sound as if played in a garage:

play echos 0.8 0.7 40 0.25 63 0.3


The chorus effect has its name because it will often be used to make a single vocal sound like a chorus. But it can be applied to other instrument samples too.

A single delay will make the sample more overloaded:

play chorus 0.7 0.9 55 0.4 0.25 2 -t

Two delays of the original samples sound like this:

play chorus 0.6 0.9 50 0.4 0.25 2 -t 60 0.32 0.4 1.3 -s

A big chorus of the sample is (three additional samples):

play chorus 0.5 0.9 50 0.4 0.25 2 -t 60 0.32 0.4 2.3 -t 40 0.3 0.3 1.3 -s


The flanger effect is like the chorus effect, but the delay varies between 0ms and maximal 5ms. It sound like wind blowing, sometimes faster or slower including changes of the speed.

Groove the sample:
play flanger

Listen carefully between the difference of sinusoidal and triangular modulation:
play flanger triangle


A reverberation effect is sometimes needed in concert halls that are too small or contain so many people that the hall’s natural reverberance is diminished.

Using the effect is easy:play reverb gives the default reverberance (50%); or
specify the desired reverberance as a percentage: play reverb 80


The phaser effect is like the flanger effect, but it uses a reverb instead of an echo and does phase shifting.

We will take a parameter setting as before (gain-out is lower since feedback can raise the output dramatically):

play phaser 0.8 0.74 3 0.4 0.5 -t

The drunken loudspeaker system (now less alcohol):

play phaser 0.9 0.85 4 0.23 1.3 -s

A popular sound of the sample is as follows:

play phaser 0.89 0.85 1 0.24 2 -t

The sample sounds if ten springs are in your ears:

play phaser 0.6 0.66 3 0.6 2 -t


The compander effect allows the dynamic range of a signal to be compressed or expanded. It works by calculating the input signal level averaged over time according to the given attack and decay parameters,and setting the output signal level according to the given transfer function parameters.

In order to visualise the transfer function, SoX can be invoked with the --plot option, e.g.
sox -n -n --plot gnuplot compand 0,0 6:-70,-60,-20 -5 > my.plt gnuplot my.plt

The following (one long) command shows how multi-band companding is typically used in FM radio:
play vol -3dB filter 8000- 32 100 mcompand \
"0.005,0.1 -47,-40,-34,-34,-17,-33" 100 \
"0.003,0.05 -47,-40,-34,-34,-17,-33" 400 \
"0.000625,0.0125 -47,-40,-34,-34,-15,-33" 1600 \
"0.0001,0.025 -47,-40,-34,-34,-31,-31,-0,-30" 6400 \
"0,0.025 -38,-31,-28,-28,-0,-25" \
vol 15dB highpass 22 highpass 22 filter -17500 256 \
vol 9dB lowpass -1 17801

The audio file is played with a simulated FM radio sound (or broadcastsignal condition if the lowpass filter at the end is skipped). Note that the pipeline is set up with US-style 75us preemphasis.

Changing the Rate of Playback.You can use stretch to change the rate of playback of an audio sample,while preserving the pitch.

For example to play at half the speed : play file.wav stretch 2

To play a file at twice the speed : play file.wav stretch 0.5

Other related options are ‘speed’ to change the speed of play (and changing the pitch accordingly), and pitch, to alter the pitch of a sample. For example to speed a sample so it plays in half the time (for those Mickey Mouse voices) : play file.wav speed 2

To raise the pitch of a sample 1 while note (100 cents) : play file.wav pitch 100

Reducing noise in a recording
First find a period of silence in your recording, such as the beginningor end of a piece. If the first 1.5 seconds of the recording are silent, do

sox file.wav -n trim 0 1.5 noiseprof /tmp/profile

Next, use the noisered effect to actually reduce the noise:

play file.wav noisered /tmp/profile

Making a recording
Thanks to Douglas Held for the following suggestion:

rec parameters filename other-effects silence 1 5 2%

Thanks to Juergen Mueller , for making such a great tool . Share this