neulab/tldr huggingface dataset:
A typical delay is around 40ms to 60ms; the modulation speed is best near 0.25Hz and the modulation depth around 2ms.  For example, a single delay: play guitar1.wav chorus 0.7 0.9 55 0.4 0.25 2 -t Two delays of the original samples: play guitar1.wav chorus 0.6 0.9 50 0.4 0.25 2 -t \ 60 0.32 0.4 1.3 -s A fuller sounding chorus (with three additional delays): play guitar1.wav 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
compand attack1,decay1{,attack2,decay2} [soft-knee-dB:]in-dB1[,out-dB1]{,in-dB2,out-dB2} [gain [initial-volume-dB [delay]]]
Compand (compress or expand) the dynamic range of the audio.
The attack and decay parameters (in seconds) determine the time over which the instantaneous level of the input signal is averaged to determine its volume; attacks refer to increases in volume and decays refer to decreases.  For most situations, the attack time (response to the music getting louder) should be shorter than the decay time because the human ear is more sensitive to sudden loud music than sudden soft music.  Where more than one pair of attack/decay parameters are specified, each input channel is companded separately and the number of pairs must agree with the number of input channels.  Typical values are 0.3,0.8 seconds.
The second parameter is a list of points on the compander's transfer function specified in dB relative to the maximum possible signal amplitude.  The input values must be in a strictly increasing order but the transfer function does not have to be monotonically rising.  If omitted, the value of out-dB1 defaults to the same value as in-dB1; levels below in-dB1 are not companded (but may have gain applied to them).  The point 0,0 is assumed but may be overridden (by 0,out-dBn).  If the list is preceded by a soft-knee-dB value, then the points at where adjacent line segments on the transfer function meet will be rounded by the amount given.  Typical values for the transfer function are 6:-70,-60,-20.
The third (optional) parameter is an additional gain in dB to be applied at all points on the transfer function and allows easy adjustment of the overall gain.
The fourth (optional) parameter is an initial level to be assumed for each channel when companding starts.  This permits the user to supply a nominal level initially, so that, for example, a very large gain is not applied to initial signal levels before the companding action has begun to operate: it is quite probable that in such an event, the output would be severely clipped while the compander gain properly adjusts itself.  A typical value (for audio which is initially quiet) is -90 dB.
The fifth (optional) parameter is a delay in seconds.  The input signal is analysed immediately to control the compander, but it is delayed before being fed to the volume adjuster.  Specifying a delay approximately equal to the attack/decay times allows the compander to effectively operate in a `predictive' rather than a reactive mode.  A typical value is 0.2 seconds.
The following example might be used to make a piece of music with both quiet and loud passages suitable for listening to in a noisy environment such as a moving vehicle: sox asz.wav asz-car.wav compand 0.3,1 6:-70,-60,-20 -5 -90 0.2 The transfer function (`6:-70,...') says that very soft sounds (below -70dB) will remain unchanged.  This will stop the compander from boosting the volume on `silent' passages such as between movements.  However, sounds in the range -60dB to 0dB (maximum volume) will be boosted so that the 60dB dynamic range of the original music will be compressed 3-to-1 into a 20dB range, which is wide enough to enjoy the music but narrow enough to get around the road noise.  The `6:' selects 6dB soft-knee companding.  The -5 (dB) output gain is needed to avoid clipping (the number is inexact, and was derived by experimentation).  The -90 (dB) for the initial volume will work fine for a clip that starts with near silence, and the delay of 0.2 (seconds) has the effect of causing the compander to react a bit more quickly to sudden volume changes.
In the next example, compand is being used as a noise-gate for when the noise is at a lower level than the signal: play infile compand .1,.2 -inf,-50.1,-inf,-50,-50 0 -90 .1 Here is another noise-gate, this time for when the noise is at a higher level than the signal (making it, in some ways, similar to squelch): play infile compand .1,.1 -45.1,-45,-inf,0,-inf 45 -90 .1 This effect supports the --plot global option (for the transfer function).
See also mcompand for a multiple-band companding effect.
contrast [enhancement-amount(75)] Comparable with compression, this effect modifies an audio signal to make it sound louder.  enhancement-amount controls the amount of the enhancement and is a number in the range 0-100.  Note that enhancement-amount = 0 still gives a significant contrast enhancement.
See also the compand and mcompand effects.
dcshift shift [limitergain] Apply a DC shift to the audio.  This can be useful to remove a DC offset (caused perhaps by a hardware problem in the recording chain) from the audio.  The effect of a DC offset is reduced headroom and hence volume.  The stat or stats effect can be used to determine if a signal has a DC offset.
The given dcshift value is a floating point number in the range of ±2 that indicates the amount to shift the audio (which is in the range of ±1).
An optional limitergain can be specified as well.  It should have a value much less than 1 (e.g. 0.05 or 0.02) and is used only on peaks to prevent clipping.
An alternative approach to removing a DC offset (albeit with a short delay) is to use the highpass filter effect at a frequency of say 10Hz, as illustrated in the following example: sox -n dc.wav synth 5 sin %0 50 sox dc.wav fixed.wav highpass 10
deemph Apply Compact Disc (IEC 60908) de-emphasis (a treble attenuation shelving filter).
Pre-emphasis was applied in the mastering of some CDs issued in the early 1980s.  These included many classical music albums, as well as now sought-after issues of albums by The Beatles, Pink Floyd and others.  Pre-emphasis should be removed at playback time by a de-emphasis filter in the playback device.  However, not all modern CD players have this filter, and very few PC CD drives have it; playing pre-emphasised audio without the correct de-emphasis filter results in audio that sounds harsh and is far from what its creators intended.
With the deemph effect, it is possible to apply the necessary de- emphasis to audio that has been extracted from a pre-emphasised CD, and then either burn the de-emphasised audio to a new CD (which will then play correctly on any CD player), or simply play the correctly de-emphasised audio files on the PC.  For example: sox track1.wav track1-deemph.wav deemph and then burn track1-deemph.wav to CD, or play track1-deemph.wav or simply play track1.wav deemph The de-emphasis filter is implemented as a biquad and requires the input audio sample rate to be either 44.1kHz or 48kHz.  Maximum deviation from the ideal response is only 0.06dB (up to 20kHz).
See also the bass and treble shelving equalisation effects.
delay {position(=)} Delay one or more audio channels such that they start at the given position.  For example, delay 1.5 +1 3000s delays the first channel by 1.5 seconds, the second channel by 2.5 seconds (one second more than the previous channel), the third channel by 3000 samples, and leaves any other channels that may be present un- delayed.  The following (one long) command plays a chime sound: play -n synth -j 3 sin %3 sin %-2 sin %-5 sin %-9 \ sin %-14 sin %-21 fade h .01 2 1.5 delay \ 1.3 1 .76 .54 .27 remix - fade h 0 2.7 2.5 norm -1 and this plays a guitar chord: play -n synth pl G2 pl B2 pl D3 pl G3 pl D4 pl G4 \ delay 0 .05 .1 .15 .2 .25 remix - fade 0 4 .1 norm -1
dither [-S|-s|-f filter] [-a] [-p precision] Apply dithering to the audio.  Dithering deliberately adds a small amount of noise to the signal in order to mask audible quantization effects that can occur if the output sample size is less than 24 bits.  With no options, this effect will add triangular (TPDF) white noise.  Noise-shaping (only for certain sample rates) can be selected with -s.  With the -f option, it is possible to select a particular noise-shaping filter from the following list: lipshitz, f-weighted, modified-e-weighted, improved-e-weighted, gesemann, shibata, low-shibata, high-shibata. Note that most filter types are available only with 44100Hz sample rate.  The filter types are distinguished by the following properties: audibility of noise, level of (inaudible, but in some circumstances, otherwise problematic) shaped high frequency noise, and processing speed. See http://sox.sourceforge.net/SoX/NoiseShaping for graphs of the different noise-shaping curves.
The -S option selects a slightly `sloped' TPDF, biased towards higher frequencies.  It can be used at any sampling rate but below ≈22k, plain TPDF is probably better, and above ≈ 37k, noise- shaping (if available) is probably better.
The -a option enables a mode where dithering (and noise-shaping if applicable) are automatically enabled only when needed.  The most likely use for this is when applying fade in or out to an already dithered file, so that the redithering applies only to the faded portions.  However, auto dithering is not fool-proof, so the fades should be carefully checked for any noise modulation; if this occurs, then either re-dither the whole file, or use trim, fade, and concatencate.
The -p option allows overriding the target precision.
If the SoX global option -R option is not given, then the pseudo- random number generator used to generate the white noise will be `reseeded', i.e. the generated noise will be different between invocations.
This effect should not be followed by any other effect that affects the audio.
See also the `Dithering' section above.
downsample [factor(2)] Downsample the signal by an integer factor: Only the first out of each factor samples is retained, the others are discarded.
No decimation filter is applied.  If the input is not a properly bandlimited baseband signal, aliasing will occur.  This may be desirable, e.g., for frequency translation.
For a general resampling effect with anti-aliasing, see rate.  See also upsample.
earwax Makes audio easier to listen to on headphones.  Adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio so that when listened to on headphones the stereo image is moved from inside your head (standard for headphones) to outside and in front of the listener (standard for speakers).
echo gain-in gain-out <delay decay> Add echoing to the audio.  Echoes are reflected sound and can occur naturally amongst mountains (and sometimes large buildings) when talking or shouting; digital echo effects emulate this behaviour and are often used to help fill out the sound of a single instrument or vocal.  The time difference between the original signal and the reflection is the `delay' (time), and the loudness of the reflected signal is the `decay'.  Multiple echoes can have different delays and decays.
Each given delay decay pair gives the delay in milliseconds and the decay (relative to gain-in) of that echo.  Gain-out is the volume of the output.  For example: This will make it sound as if there are twice as many instruments as are actually playing: play lead.aiff echo 0.8 0.88 60 0.4 If the delay is very short, then it sound like a (metallic) robot playing music: play lead.aiff echo 0.8 0.88 6 0.4 A longer delay will sound like an open air concert in the mountains: play lead.aiff echo 0.8 0.9 1000 0.3 One mountain more, and: play lead.aiff echo 0.8 0.9 1000 0.3 1800 0.25
echos gain-in gain-out <delay decay> Add a sequence of echoes to the audio.  Each delay decay pair gives the delay in milliseconds and the decay (relative to gain- in) of that echo.  Gain-out is the volume of the output.
Like the echo effect, echos stand for `ECHO in Sequel', that is the first 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.  Care should be taken using many echos; a single echos has the same effect as a single echo.
The sample will be bounced twice in symmetric echos: play lead.aiff echos 0.8 0.7 700 0.25 700 0.3 The sample will be bounced twice in asymmetric echos: play lead.aiff echos 0.8 0.7 700 0.25 900 0.3 The sample will sound as if played in a garage: play lead.aiff echos 0.8 0.7 40 0.25 63 0.3
equalizer frequency[k] width[q|o|h|k] gain Apply a two-pole peaking equalisation (EQ) filter.  With this filter, the signal-level at and around a selected frequency can be increased or decreased, whilst (unlike band-pass and band-reject filters) that at all other frequencies is unchanged.
frequency gives the filter's central frequency in Hz, width, the band-width, and gain the required gain or attenuation in dB. Beware of Clipping when using a positive gain.
In order to produce complex equalisation curves, this effect can be given several times, each with a different central frequency.
The filter is described in detail in [1].
See also bass and treble for shelving equalisation effects.
fade [type] fade-in-length [stop-position(=) [fade-out-length]] Apply a fade effect to the beginning, end, or both of the audio.
An optional type can be specified to select the shape of the fade curve: q for quarter of a sine wave, h for half a sine wave, t for linear (`triangular') slope, l for logarithmic, and p for inverted parabola.  The default is logarithmic.
A fade-in starts from the first sample and ramps the signal level from 0 to full volume over the time given as fade-in-length. Specify 0 if no fade-in is wanted.
For fade-outs, the audio will be truncated at stop-position and the signal level will be ramped from full volume down to 0 over an interval of fade-out-length before the stop-position.  If fade- out-length is not specified, it defaults to the same value as fade-in-length.  No fade-out is performed if stop-position is not specified.  If the audio length can be determined from the input file header and any previous effects, then -0 (or, for historical reasons, 0) may be specified for stop-position to indicate the usual case of a fade-out that ends at the end of the input audio stream.
Any time specification may be used for fade-in-length and fade- out-length.
See also the splice effect.
fir [coefs-file|coefs] Use SoX's FFT convolution engine with given FIR filter coefficients.  If a single argument is given then this is treated as the name of a file containing the filter coefficients (white- space separated; may contain `#' comments).  If the given filename is `-', or if no argument is given, then the coefficients are read from the `standard input' (stdin); otherwise, coefficients may be given on the command line.  Examples: sox infile outfile fir 0.0195 -0.082 0.234 0.891 -0.145 0.043 sox infile outfile fir coefs.txt with coefs.txt containing # HP filter # freq=10000 1.2311233052619888e-01 -4.4777096106211783e-01 5.1031563346705155e-01 -6.6502926320995331e-02 ...
flanger [delay depth regen width speed shape phase interp] Apply a flanging effect to the audio.  See [3] for a detailed description of flanging.
All parameters are optional (right to left).
Range     Default   Description delay     0 - 30       0      Base delay in milliseconds. depth     0 - 10       2      Added swept delay in milliseconds. regen    -95 - 95      0      Percentage regeneration (delayed signal feedback). width    0 - 100      71      Percentage of delayed signal mixed with original. speed    0.1 - 10     0.5     Sweeps per second (Hz). shape                 sin     Swept wave shape: sine|triangle. phase    0 - 100      25      Swept wave percentage phase-shift for multi-channel (e.g. stereo) flange; 0 = 100 = same phase on each channel. interp                lin     Digital delay-line interpolation: linear|quadratic.
gain [-e|-B|-b|-r] [-n] [-l|-h] [gain-dB] Apply amplification or attenuation to the audio signal, or, in some cases, to some of its channels.  Note that use of any of -e, -B, -b, -r, or -n requires temporary file space to store the audio to be processed, so may be unsuitable for use with `streamed' audio.
Without other options, gain-dB is used to adjust the signal power level by the given number of dB: positive amplifies (beware of Clipping), negative attenuates.  With other options, the gain-dB amplification or attenuation is (logically) applied after the processing due to those options.
Given the -e option, the levels of the audio channels of a multi- channel file are `equalised', i.e.  gain is applied to all channels other than that with the highest peak level, such that all channels attain the same peak level (but, without also giving -n, the audio is not `normalised').
The -B (balance) option is similar to -e, but with -B, the RMS level is used instead of the peak level.  -B might be used to correct stereo imbalance caused by an imperfect record turntable cartridge.   Note that unlike -e, -B might cause some clipping.
-b is similar to -B but has clipping protection, i.e.  if necessary to prevent clipping whilst balancing, attenuation is applied to all channels.  Note, however, that in conjunction with -n, -B and -b are synonymous.
The -r option is used in conjunction with a prior invocation of gain with the -h option - see below for details.
The -n option normalises the audio to 0dB FSD; it is often used in conjunction with a negative gain-dB to the effect that the audio is normalised to a given level below 0dB.  For example, sox infile outfile gain -n normalises to 0dB, and sox infile outfile gain -n -3 normalises to -3dB.
The -l option invokes a simple limiter, e.g. sox infile outfile gain -l 6 will apply 6dB of gain but never clip.  Note that limiting more than a few dBs more than occasionally (in a piece of audio) is not recommended as it can cause audible distortion.  See the compand effect for a more capable limiter.
The -h option is used to apply gain to provide head-room for subsequent processing.  For example, with sox infile outfile gain -h bass +6 6dB of attenuation will be applied prior to the bass boosting effect thus ensuring that it will not clip.  Of course, with bass, it is obvious how much headroom will be needed, but with other effects (e.g.  rate, dither) it is not always as clear.  Another advantage of using gain -h rather than an explicit attenuation, is that if the headroom is not used by subsequent effects, it can be reclaimed with gain -r, for example: sox infile outfile gain -h bass +6 rate 44100 gain -r The above effects chain guarantees never to clip nor amplify; it attenuates if necessary to prevent clipping, but by only as much as is needed to do so.
Output formatting (dithering and bit-depth reduction) also requires headroom (which cannot be `reclaimed'), e.g. sox infile outfile gain -h bass +6 rate 44100 gain -rh dither Here, the second gain invocation, reclaims as much of the headroom as it can from the preceding effects, but retains as much headroom as is needed for subsequent processing.  The SoX global option -G can be given to automatically invoke gain -h and gain -r.
See also the norm and vol effects.
highpass|lowpass [-1|-2] frequency[k] [width[q|o|h|k]] Apply a high-pass or low-pass filter with 3dB point frequency. The filter can be either single-pole (with -1), or double-pole (the default, or with -2).  width applies only to double-pole filters; the default is Q = 0.707 and gives a Butterworth response.  The filters roll off at 6dB per pole per octave (20dB per pole per decade).  The double-pole filters are described in detail in [1].
See also sinc for filters with a steeper roll-off.
hilbert [-n taps] Apply an odd-tap Hilbert transform filter, phase-shifting the signal by 90 degrees.
This is used in many matrix coding schemes and for analytic signal generation.  The process is often written as a multiplication by i (or j), the imaginary unit.
An odd-tap Hilbert transform filter has a bandpass characteristic, attenuating the lowest and highest frequencies.  Its bandwidth can be controlled by the number of filter taps, which can be specified with -n.  By default, the number of taps is chosen for a cutoff frequency of about 75 Hz.
ladspa [-l|-r] module [plugin] [argument ...] Apply a LADSPA [5] (Linux Audio Developer's Simple Plugin API) plugin.  Despite the name, LADSPA is not Linux-specific, and a wide range of effects is available as LADSPA plugins, such as cmt [6] (the Computer Music Toolkit) and Steve Harris's plugin collection [7]. The first argument is the plugin module, the second the name of the plugin (a module can contain more than one plugin), and any other arguments are for the control ports of the plugin. Missing arguments are supplied by default values if possible.
Normally, the number of input ports of the plugin must match the number of input channels, and the number of output ports determines the output channel count.  However, the -r (replicate) option allows cloning a mono plugin to handle multi-channel input.
Some plugins introduce latency which SoX may optionally compensate for.  The -l (latency compensation) option automatically compensates for latency as reported by the plugin via an output control port named "latency".
If found, the environment variable LADSPA_PATH will be used as search path for plugins.
loudness [gain [reference]] Loudness control - similar to the gain effect, but provides equalisation for the human auditory system.  See http://en.wikipedia.org/wiki/Loudness for a detailed description of loudness.  The gain is adjusted by the given gain parameter (usually negative) and the signal equalised according to ISO 226 w.r.t. a reference level of 65dB, though an alternative reference level may be given if the original audio has been equalised for some other optimal level.  A default gain of -10dB is used if a gain value is not given.
See also the gain effect.
lowpass [-1|-2] frequency[k] [width[q|o|h|k]] Apply a low-pass filter.  See the description of the highpass effect for details.
mcompand "attack1,decay1{,attack2,decay2} [soft-knee-dB:]in-dB1[,out-dB1]{,in-dB2,out-dB2} [gain [initial-volume-dB [delay]]]" {crossover-freq[k] "attack1,..."}
The multi-band compander is similar to the single-band compander but the audio is first divided into bands using Linkwitz-Riley cross-over filters and a separately specifiable compander run on each band.  See the compand effect for the definition of its parameters.  Compand parameters are specified between double quotes and the crossover frequency for that band is given by crossover-freq; these can be repeated to create multiple bands.
For example, the following (one long) command shows how multi-band companding is typically used in FM radio: play track1.wav gain -3 sinc 8000- 29 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" \ gain 15 highpass 22 highpass 22 sinc -n 255 -b 16 -17500 \ gain 9 lowpass -1 17801 The audio file is played with a simulated FM radio sound (or broadcast signal condition if the lowpass filter at the end is skipped).  Note that the pipeline is set up with US-style 75us pre-emphasis.
See also compand for a single-band companding effect.
noiseprof [profile-file] Calculate a profile of the audio for use in noise reduction.  See the description of the noisered effect for details.
noisered [profile-file [amount]] Reduce noise in the audio signal by profiling and filtering.  This effect is moderately effective at removing consistent background noise such as hiss or hum.  To use it, first run SoX with the noiseprof effect on a section of audio that ideally would contain silence but in fact contains noise - such sections are typically found at the beginning or the end of a recording.  noiseprof will write out a noise profile to profile-file, or to stdout if no profile-file or if `-' is given.  E.g. sox speech.wav -n trim 0 1.5 noiseprof speech.noise-profile To actually remove the noise, run SoX again, this time with the noisered effect; noisered will reduce noise according to a noise profile (which was generated by noiseprof), from profile-file, or from stdin if no profile-file or if `-' is given.  E.g. sox speech.wav cleaned.wav noisered speech.noise-profile 0.3 How much noise should be removed is specified by amount-a number between 0 and 1 with a default of 0.5.  Higher numbers will remove more noise but present a greater likelihood of removing wanted components of the audio signal.  Before replacing an original recording with a noise-reduced version, experiment with different amount values to find the optimal one for your audio; use headphones to check that you are happy with the results, paying particular attention to quieter sections of the audio.
On most systems, the two stages - profiling and reduction - can be combined using a pipe, e.g. sox noisy.wav -n trim 0 1 noiseprof | play noisy.wav noisered
norm [dB-level] Normalise the audio.  norm is just an alias for gain -n; see the gain effect for details.
oops   Out Of Phase Stereo effect.  Mixes stereo to twin-mono where each mono channel contains the difference between the left and right stereo channels.  This is sometimes known as the `karaoke' effect as it often has the effect of removing most or all of the vocals from a recording.  It is equivalent to remix 1,2i 1,2i.
overdrive [gain(20) [colour(20)]] Non linear distortion.  The colour parameter controls the amount of even harmonic content in the over-driven output.
pad { length[@position(=)] } Pad the audio with silence, at the beginning, the end, or any specified points through the audio.  length is the amount of silence to insert and position the position in the input audio stream at which to insert it.  Any number of lengths and positions may be specified, provided that a specified position is not less that the previous one, and any time specification may be used for them.  position is optional for the first and last lengths specified and if omitted correspond to the beginning and the end of the audio respectively.  For example, pad 1.5 1.5 adds 1.5 seconds of silence padding at each end of the audio, whilst pad 4000s@3:00 inserts 4000 samples of silence 3 minutes into the audio.  If silence is wanted only at the end of the audio, specify either the end position or specify a zero-length pad at the start.
See also delay for an effect that can add silence at the beginning of the audio on a channel-by-channel basis.
phaser gain-in gain-out delay decay speed [-s|-t] Add a phasing effect to the audio.  See [3] for a detailed description of phasing.
delay/decay/speed gives the delay in milliseconds and the decay (relative to gain-in) with a modulation speed in Hz.  The modulation is either sinusoidal (-s)  - preferable for multiple instruments, or triangular (-t)  - gives single instruments a sharper phasing effect.  The decay should be less than 0.5 to avoid feedback, and usually no less than 0.1.  Gain-out is the volume of the output.
For example: play snare.flac phaser 0.8 0.74 3 0.4 0.5 -t Gentler: play snare.flac phaser 0.9 0.85 4 0.23 1.3 -s A popular sound: play snare.flac phaser 0.89 0.85 1 0.24 2 -t More severe: play snare.flac phaser 0.6 0.66 3 0.6 2 -t
pitch [-q] shift [segment [search [overlap]]] Change the audio pitch (but not tempo).
shift gives the pitch shift as positive or negative `cents' (i.e. 100ths of a semitone).  See the tempo effect for a description of the other parameters.
See also the bend, speed, and tempo effects.
rate [-q|-l|-m|-h|-v] [override-options] RATE[k] Change the audio sampling rate (i.e. resample the audio) to any given RATE (even non-integer if this is supported by the output file format) using a quality level defined as follows:
Quality   Band-   Rej dB   Typical Use width -q     quick     n/a    ≈30 @    playback on Fs/4    ancient hardware -l      low      80%     100     playback on old hardware -m    medium     95%     100     audio playback -h     high      95%     125     16-bit mastering (use with dither) -v   very high   95%     175     24-bit mastering
where Band-width is the percentage of the audio frequency band that is preserved and Rej dB is the level of noise rejection. Increasing levels of resampling quality come at the expense of increasing amounts of time to process the audio.  If no quality option is given, the quality level used is `high' (but see `Playing & Recording Audio' above regarding playback).
The `quick' algorithm uses cubic interpolation; all others use band-limited interpolation.  By default, all algorithms have a `linear' phase response; for `medium', `high' and `very high', the phase response is configurable (see below).
The rate effect is invoked automatically if SoX's -r option specifies a rate that is different to that of the input file(s). Alternatively, if this effect is given explicitly, then SoX's -r option need not be given.  For example, the following two commands are equivalent: sox input.wav -r 48k output.wav bass -b 24 sox input.wav        output.wav bass -b 24 rate 48k though the second command is more flexible as it allows rate options to be given, and allows the effects to be ordered arbitrarily.
Warning: technically detailed discussion follows.
The simple quality selection described above provides settings that satisfy the needs of the vast majority of resampling tasks. Occasionally, however, it may be desirable to fine-tune the resampler's filter response; this can be achieved using override options, as detailed in the following table:
-M/-I/-L     Phase response = minimum/intermediate/linear -s           Steep filter (band-width = 99%) -a           Allow aliasing/imaging above the pass-band -b 74-99.7   Any band-width %
-p 0-100     Any phase response (0 = minimum, 25 = intermediate, 50 = linear, 100 = maximum)
N.B.  Override options cannot be used with the `quick' or `low' quality algorithms.
All resamplers use filters that can sometimes create `echo' (a.k.a.  `ringing') artefacts with transient signals such as those that occur with `finger snaps' or other highly percussive sounds. Such artefacts are much more noticeable to the human ear if they occur before the transient (`pre-echo') than if they occur after it (`post-echo').  Note that frequency of any such artefacts is related to the smaller of the original and new sampling rates but that if this is at least 44.1kHz, then the artefacts will lie outside the range of human hearing.
A phase response setting may be used to control the distribution of any transient echo between `pre' and `post': with minimum phase, there is no pre-echo but the longest post-echo; with linear phase, pre and post echo are in equal amounts (in signal terms, but not audibility terms); the intermediate phase setting attempts to find the best compromise by selecting a small length (and level) of pre-echo and a medium lengthed post-echo.
Minimum, intermediate, or linear phase response is selected using the -M, -I, or -L option; a custom phase response can be created with the -p option.  Note that phase responses between `linear' and `maximum' (greater than 50) are rarely useful.
A resampler's band-width setting determines how much of the frequency content of the original signal (w.r.t. the original sample rate when up-sampling, or the new sample rate when down- sampling) is preserved during conversion.  The term `pass-band' is used to refer to all frequencies up to the band-width point (e.g. for 44.1kHz sampling rate, and a resampling band-width of 95%, the pass-band represents frequencies from 0Hz (D.C.) to circa 21kHz). Increasing the resampler's band-width results in a slower conversion and can increase transient echo artefacts (and vice versa).
The -s `steep filter' option changes resampling band-width from the default 95% (based on the 3dB point), to 99%.  The -b option allows the band-width to be set to any value in the range 74-99.7 %, but note that band-width values greater than 99% are not recommended for normal use as they can cause excessive transient echo.
If the -a option is given, then aliasing/imaging above the pass- band is allowed.  For example, with 44.1kHz sampling rate, and a resampling band-width of 95%, this means that frequency content above 21kHz can be distorted; however, since this is above the pass-band (i.e.  above the highest frequency of interest/audibility), this may not be a problem.  The benefits of allowing aliasing/imaging are reduced processing time, and reduced (by almost half) transient echo artefacts.  Note that if this option is given, then the minimum band-width allowable with -b increases to 85%.
Examples: sox input.wav -b 16 output.wav rate -s -a 44100 dither -s default (high) quality resampling; overrides: steep filter, allow aliasing; to 44.1kHz sample rate; noise-shaped dither to 16-bit WAV file. sox input.wav -b 24 output.aiff rate -v -I -b 90 48k very high quality resampling; overrides: intermediate phase, band- width 90%; to 48k sample rate; store output to 24-bit AIFF file.
The pitch and speed effects use the rate effect at their core.
remix [-a|-m|-p] <out-spec> out-spec  = in-spec{,in-spec} | 0 in-spec   = [in-chan][-[in-chan2]][vol-spec] vol-spec  = p|i|v[volume]
Select and mix input audio channels into output audio channels. Each output channel is specified, in turn, by a given out-spec: a list of contributing input channels and volume specifications.
Note that this effect operates on the audio channels within the SoX effects processing chain; it should not be confused with the -m global option (where multiple files are mix-combined before entering the effects chain).
An out-spec contains comma-separated input channel-numbers and hyphen-delimited channel-number ranges; alternatively, 0 may be given to create a silent output channel.  For example, sox input.wav output.wav remix 6 7 8 0 creates an output file with four channels, where channels 1, 2, and 3 are copies of channels 6, 7, and 8 in the input file, and channel 4 is silent.  Whereas sox input.wav output.wav remix 1-3,7 3 creates a (somewhat bizarre) stereo output file where the left channel is a mix-down of input channels 1, 2, 3, and 7, and the right channel is a copy of input channel 3.
Where a range of channels is specified, the channel numbers to the left and right of the hyphen are optional and default to 1 and to the number of input channels respectively. Thus sox input.wav output.wav remix - performs a mix-down of all input channels to mono.
By default, where an output channel is mixed from multiple (n) input channels, each input channel will be scaled by a factor of ¹/n.  Custom mixing volumes can be set by following a given input channel or range of input channels with a vol-spec (volume specification).  This is one of the letters p, i, or v, followed by a volume number, the meaning of which depends on the given letter and is defined as follows:
Letter   Volume number        Notes p      power adjust in dB   0 = no change i      power adjust in dB   As `p', but invert the audio v      voltage multiplier   1 = no change, 0.5 ≈ 6dB attenuation, 2 ≈ 6dB gain, -1 = invert
If an out-spec includes at least one vol-spec then, by default, ¹/n scaling is not applied to any other channels in the same out- spec (though may be in other out-specs).  The -a (automatic) option however, can be given to retain the automatic scaling in this case.  For example, sox input.wav output.wav remix 1,2 3,4v0.8 results in channel level multipliers of 0.5,0.5 1,0.8, whereas sox input.wav output.wav remix -a 1,2 3,4v0.8 results in channel level multipliers of 0.5,0.5 0.5,0.8.
The -m (manual) option disables all automatic volume adjustments, so sox input.wav output.wav remix -m 1,2 3,4v0.8 results in channel level multipliers of 1,1 1,0.8.
The volume number is optional and omitting it corresponds to no volume change; however, the only case in which this is useful is in conjunction with i.  For example, if input.wav is stereo, then sox input.wav output.wav remix 1,2i is a mono equivalent of the oops effect.
If the -p option is given, then any automatic ¹/n scaling is replaced by ¹/√n (`power') scaling; this gives a louder mix but one that might occasionally clip.
One use of the remix effect is to split an audio file into a set of files, each containing one of the constituent channels (in order to perform subsequent processing on individual audio channels).  Where more than a few channels are involved, a script such as the following (Bourne shell script) is useful: #!/bin/sh chans=`soxi -c "$1"` while [ $chans -ge 1 ]; do chans0=`printf %02i $chans`   # 2 digits hence up to 99 chans out=`echo "$1"|sed "s/\(.*\)\.\(.*\)/\1-$chans0.\2/"` sox "$1" "$out" remix $chans chans=`expr $chans - 1` done If a file input.wav containing six audio channels were given, the script would produce six output files: input-01.wav, input-02.wav, ..., input-06.wav.
See also the swap effect.
repeat [count(1)|-] Repeat the entire audio count times, or once if count is not given.  The special value - requests infinite repetition. Requires temporary file space to store the audio to be repeated. Note that repeating once yields two copies: the original audio and the repeated audio.
reverb [-w|--wet-only] [reverberance (50%) [HF-damping (50%) [room-scale (100%) [stereo-depth (100%) [pre-delay (0ms) [wet-gain (0dB)]]]]]]
Add reverberation to the audio using the `freeverb' algorithm.  A reverberation effect is sometimes desirable for concert halls that are too small or contain so many people that the hall's natural reverberance is diminished.  Applying a small amount of stereo reverb to a (dry) mono signal will usually make it sound more natural.  See [3] for a detailed description of reverberation.
Note that this effect increases both the volume and the length of the audio, so to prevent clipping in these domains, a typical invocation might be: play dry.wav gain -3 pad 0 3 reverb The -w option can be given to select only the `wet' signal, thus allowing it to be processed further, independently of the `dry' signal.  E.g. play -m voice.wav "|sox voice.wav -p reverse reverb -w reverse" for a reverse reverb effect.
reverse Reverse the audio completely.  Requires temporary file space to store the audio to be reversed.
riaa   Apply RIAA vinyl playback equalisation.  The sampling rate must be one of: 44.1, 48, 88.2, 96 kHz.
silence [-l] above-periods [duration threshold[d|%] [below-periods duration threshold[d|%]]
Removes silence from the beginning, middle, or end of the audio. `Silence' is determined by a specified threshold.
The above-periods value is used to indicate if audio should be trimmed at the beginning of the audio. A value of zero indicates no silence should be trimmed from the beginning. When specifying a non-zero above-periods, it trims audio up until it finds non- silence. Normally, when trimming silence from beginning of audio the above-periods will be 1 but it can be increased to higher values to trim all audio up to a specific count of non-silence periods. For example, if you had an audio file with two songs that each contained 2 seconds of silence before the song, you could specify an above-period of 2 to strip out both silence periods and the first song.
When above-periods is non-zero, you must also specify a duration and threshold. duration indicates the amount of time that non- silence must be detected before it stops trimming audio. By increasing the duration, burst of noise can be treated as silence and trimmed off.
threshold is used to indicate what sample value you should treat as silence.  For digital audio, a value of 0 may be fine but for audio recorded from analog, you may wish to increase the value to account for background noise.
When optionally trimming silence from the end of the audio, you specify a below-periods count.  In this case, below-period means to remove all audio after silence is detected.  Normally, this will be a value 1 of but it can be increased to skip over periods of silence that are wanted.  For example, if you have a song with 2 seconds of silence in the middle and 2 second at the end, you could set below-period to a value of 2 to skip over the silence in the middle of the audio.
For below-periods, duration specifies a period of silence that must exist before audio is not copied any more.  By specifying a higher duration, silence that is wanted can be left in the audio. For example, if you have a song with an expected 1 second of silence in the middle and 2 seconds of silence at the end, a duration of 2 seconds could be used to skip over the middle silence.
Unfortunately, you must know the length of the silence at the end of your audio file to trim off silence reliably.  A workaround is to use the silence effect in combination with the reverse effect. By first reversing the audio, you can use the above-periods to reliably trim all audio from what looks like the front of the file.  Then reverse the file again to get back to normal.
To remove silence from the middle of a file, specify a below- periods that is negative.  This value is then treated as a positive value and is also used to indicate that the effect should restart processing as specified by the above-periods, making it suitable for removing periods of silence in the middle of the audio.
The option -l indicates that below-periods duration length of audio should be left intact at the beginning of each period of silence.  For example, if you want to remove long pauses between words but do not want to remove the pauses completely.
duration is a time specification with the peculiarity that a bare number is interpreted as a sample count, not as a number of seconds.  For specifying seconds, either use the t suffix (as in `2t') or specify minutes, too (as in `0:02').
threshold numbers may be suffixed with d to indicate the value is in decibels, or % to indicate a percentage of maximum value of the sample value (0% specifies pure digital silence).
The following example shows how this effect can be used to start a recording that does not contain the delay at the start which usually occurs between `pressing the record button' and the start of the performance: rec parameters filename other-effects silence 1 5 2%
sinc [-a att|-b beta] [-p phase|-M|-I|-L] [-t tbw|-n taps] [freqHP] [-freqLP [-t tbw|-n taps]] Apply a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject filter to the signal.  The freqHP and freqLP parameters give the frequencies of the 6dB points of a high-pass and low-pass filter that may be invoked individually, or together. If both are given, then freqHP less than freqLP creates a band- pass filter, freqHP greater than freqLP creates a band-reject filter.  For example, the invocations sinc 3k sinc -4k sinc 3k-4k sinc 4k-3k create a high-pass, low-pass, band-pass, and band-reject filter respectively.
The default stop-band attenuation of 120dB can be overridden with -a; alternatively, the kaiser-window `beta' parameter can be given directly with -b.
The default transition band-width of 5% of the total band can be overridden with -t (and tbw in Hertz); alternatively, the number of filter taps can be given directly with -n.
If both freqHP and freqLP are given, then a -t or -n option given to the left of the frequencies applies to both frequencies; one of these options given to the right of the frequencies applies only to freqLP.
The -p, -M, -I, and -L options control the filter's phase response; see the rate effect for details.
spectrogram [options] Create a spectrogram of the audio; the audio is passed unmodified through the SoX processing chain.  This effect is optional - type sox --help and check the list of supported effects to see if it has been included.
The spectrogram is rendered in a Portable Network Graphic (PNG) file, and shows time in the X-axis, frequency in the Y-axis, and audio signal magnitude in the Z-axis.  Z-axis values are represented by the colour (or optionally the intensity) of the pixels in the X-Y plane.  If the audio signal contains multiple channels then these are shown from top to bottom starting from channel 1 (which is the left channel for stereo audio).
For example, if `my.wav' is a stereo file, then with sox my.wav -n spectrogram a spectrogram of the entire file will be created in the file `spectrogram.png'.  More often though, analysis of a smaller portion of the audio is required; e.g. with sox my.wav -n remix 2 trim 20 30 spectrogram the spectrogram shows information only from the second (right) channel, and of thirty seconds of audio starting from twenty seconds in.  To analyse a small portion of the frequency domain, the rate effect may be used, e.g. sox my.wav -n rate 6k spectrogram allows detailed analysis of frequencies up to 3kHz (half the sampling rate) i.e. where the human auditory system is most sensitive.  With sox my.wav -n trim 0 10 spectrogram -x 600 -y 200 -z 100 the given options control the size of the spectrogram's X, Y & Z axes (in this case, the spectrogram area of the produced image will be 600 by 200 pixels in size and the Z-axis range will be 100 dB).  Note that the produced image includes axes legends etc. and so will be a little larger than the specified spectrogram size. In this example: sox -n -n synth 6 tri 10k:14k spectrogram -z 100 -w kaiser an analysis `window' with high dynamic range is selected to best display the spectrogram of a swept triangular wave.  For a smilar example, append the following to the `chime' command in the description of the delay effect (above): rate 2k spectrogram -X 200 -Z -10 -w kaiser Options are also available to control the appearance (colour-set, brightness, contrast, etc.) and filename of the spectrogram; e.g. with sox my.wav -n spectrogram -m -l -o print.png a spectrogram is created suitable for printing on a `black and white' printer.
-x num Change the (maximum) width (X-axis) of the spectrogram from its default value of 800 pixels to a given number between 100 and 200000.  See also -X and -d.
-X num X-axis pixels/second; the default is auto-calculated to fit the given or known audio duration to the X-axis size, or 100 otherwise.  If given in conjunction with -d, this option affects the width of the spectrogram; otherwise, it affects the duration of the spectrogram.  num can be from 1 (low time resolution) to 5000 (high time resolution) and need not be an integer.  SoX may make a slight adjustment to the given number for processing quantisation reasons; if so, SoX will report the actual number used (viewable when the SoX global option -V is in effect).  See also -x and -d.
-y num Sets the Y-axis size in pixels (per channel); this is the number of frequency `bins' used in the Fourier analysis that produces the spectrogram.  N.B. it can be slow to produce the spectrogram if this number is not one more than a power of two (e.g. 129).  By default the Y-axis size is chosen automatically (depending on the number of channels). See -Y for alternative way of setting spectrogram height.
-Y num Sets the target total height of the spectrogram(s).  The default value is 550 pixels.  Using this option (and by default), SoX will choose a height for individual spectrogram channels that is one more than a power of two, so the actual total height may fall short of the given number.  However, there is also a minimum height per channel so if there are many channels, the number may be exceeded.  See -y for alternative way of setting spectrogram height.
-z num Z-axis (colour) range in dB, default 120.  This sets the dynamic-range of the spectrogram to be -num dBFS to 0 dBFS. Num may range from 20 to 180.  Decreasing dynamic-range effectively increases the `contrast' of the spectrogram display, and vice versa.
-Z num Sets the upper limit of the Z-axis in dBFS.  A negative num effectively increases the `brightness' of the spectrogram display, and vice versa.
-q num Sets the Z-axis quantisation, i.e. the number of different colours (or intensities) in which to render Z-axis values. A small number (e.g. 4) will give a `poster'-like effect making it easier to discern magnitude bands of similar level.  Small numbers also usually result in small PNG files.  The number given specifies the number of colours to use inside the Z-axis range; two colours are reserved to represent out-of-range values.