SoX(1) SoX(1)
NAME
sox - Sound eXchange : universal sound sample translator
SYNOPSIS
sox infile1 [ infile2 ... ] outfile
sox [ general options ] [ format options ] infile1
[ [ format options ] infile2 ... ] [ format options ] outfile
[ effect [ effect options ] ... ]
soxmix infile1 infile2 [ infile3 ... ] outfile
soxmix [ general options ] [ format options ] infile1
[ format options ] infile2
[ [ format options ] infile3 ... ]
[ format options ] outfile
[ effect [ effect options ] ... ]
General options:
[ -h ] [ -p ] [ -V ]
Format options:
[ -t filetype ] [ -r rate ] [ -s/-u/-U/-A/-a/-i/-g/-f ]
[ -b/-w/-l/-d ] [ -v volume ]
[ -c channels ] [ -x ] [ -e ]
Effects:
avg [ -l | -r | -f | -b | -1 | -2 | -3 | -4 | n,n,...,n ]
band [ -n ] center [ width ]
bandpass frequency bandwidth
bandreject frequency bandwidth
chorus gain-in gain out delay decay speed depth
-s | -t [ delay decay speed depth -s | -t ]
compand attack1,decay1[,attack2,decay2...]
in-dB1,out-dB1[,in-dB2,out-dB2...]
[ gain [ initial-volume [ delay ] ] ]
copy
dcshift shift [ limitergain ]
deemph
earwax
echo gain-in gain-out delay decay [ delay decay ... ]
echos gain-in gain-out delay decay [ delay decay ... ]
fade [ type ] fade-in-length
[ stop-time [ fade-out-length ] ]
filter [ low ]-[ high ] [ window-len [ beta ]]
flanger gain-in gain-out delay decay speed < -s | -t >
highp frequency
highpass frequency
lowp frequency
lowpass frequency
mask
mcompand "attack1,decay1[,attack2,decay2...]
in-dB1,out-dB1[,in-dB2,out-dB2...]
[ gain [ initial-volume [ delay ] ] ]" xover_freq
noiseprof [profile-file]
noisered profile-file [threshold]
pan direction
phaser gain-in gain-out delay decay speed < -s | -t >
pick [ -1 | -2 | -3 | -4 | -l | -r | -f | -b ]
pitch shift [ width interpole fade ]
polyphase [ -w < nut / ham > ]
[ -width < long / short / # > ]
[ -cutoff # ]
rate
repeat count
resample [ -qs | -q | -ql ] [ rolloff [ beta ] ]
reverb gain-out reverb-time delay [ delay ... ]
reverse
silence above_periods [ duration threshold[ d | % ]
[ below_periods duration
threshold[ d | % ]]
speed [ -c ] factor
stat [ -s n ] [ -rms ] [ -v ] [ -d ]
stretch [ factor [ window fade shift fading ]
swap [ 1 2 | 1 2 3 4 ]
synth [ length ] type mix [ freq [ -freq2 ]
[ off ] [ ph ] [ p1 ] [ p2 ] [ p3 ]
trim start [ length ]
vibro speed [ depth ]
vol gain [ type [ limitergain ] ]
DESCRIPTION
SoX is a command line program that can convert most popular audio files
to most other popular audio file formats. It can optionally change the
audio sample data type and apply one or more sound effects to the file
during this translation.
If more then one input file is specified then they are concatenated
into the output file. In this case, it has a restriction that all
input files must be of the same data type and sample rates.
soxmix is functionally the same as the command line program sox expect
that it takes two or more files as input and mixes the audio together
to produce a single file as output. It has a restriction that all
input files must be of the same data type and sample rates.
There are two types of audio file formats that SoX can work with. The
first are self-describing file formats. These contain a header that
completely describe the characteristics of the audio data that follows.
The second type are header-less data, or sometimes called raw data. A
user must pass enough information to SoX on the command line so that it
knows what type of data it contains.
Audio data can usually be totally described by four characteristics:
rate The sample rate is in samples per second. For example, CD
sample rates are at 44100.
data size The precision the data is stored in. Most popular are 8-bit
bytes or 16-bit words.
data encoding
What encoding the data type uses. Examples are u-law, ADPCM,
or signed linear data.
channels How many channels are contained in the audio data. Mono and
Stereo are the two most common.
Please refer to the soxexam(1) manual page for a long description with
examples on how to use SoX with various types of file formats.
OPTIONS
The option syntax is a little grotty, but in essence:
sox file.au file.wav
translates a sound file in SUN Sparc .AU format into a Microsoft .WAV
file, while
sox -v 0.5 file.au -r 12000 file.wav mask
does the same format translation but also lowers the amplitude by 1/2,
changes the sampling rate to 12000 hertz, and applies the mask sound
effect to the audio data.
The following will mix two sound files together to to produce a single
sound file.
soxmix music.wav voice.wav mixed.wav
Format options:
Format options effect the audio samples that they immediately precede.
If they are placed before the input file name then they effect the
input data. If they are placed before the output file name then they
will effect the output data. By taking advantage of this, you can
override a input file’s corrupted header or produce an output file that
is totally different style then the input file. It is also how SoX is
informed about the format of raw input data.
-t filetype
gives the type of the sound sample file. Useful when file
extension is not standard or for specifying the .auto file
type.
-r rate Gives the sample rate in Hertz of the file. To cause the
output file to have a different sample rate than the input
file, include this option as a part of the output options.
If the input and output files have different rates then a
sample rate change effect must be ran. If a sample rate
changing effect is not specified then a default one will
internally be ran by SoX using its default parameters.
-v volume Change amplitude (floating point); less than 1.0 decreases,
greater than 1.0 increases. May use a negative number to
invert the phase of the audio data. It is interesting to
note that we perceive volume logarithmically but this adjusts
the amplitude linearly.
As with other format options, the volume option effects the
file its specified with. This is useful whe processing muti-
ple input files as the volume adjustment can be specified for
each input file or just once to adjust the output file. This
can be compared to an audio mixer were you can control the
volume of each input as well as a master volume (output
side).
soxmix defaults the value of the -v option for each input
file to 1/input_file_count. This means if your mixing two
input files together then each input file’s volume is
adjusted by 0.5. This is done to prevent clipping of audio
data during the mixing operation. Users will most likely not
be happy with this large of a volume adjustment and can spec-
ify the -v option to override this default value.
Note: For the non-mixing case, see the stat effect for infor-
mation on finding the maximum volume adjustment that can be
done with this option without causing audio data to be
clipped.
-s/-u/-U/-A/-a/-i/-g/-f
The sample data encoding is signed linear (2’s complement),
unsigned linear, u-law (logarithmic), A-law (logarithmic),
ADPCM, IMA_ADPCM, GSM, or Floating-point.
U-law (actually shorthand for mu-law) and A-law are the U.S.
and international standards fo