Difference between revisions of "SoX"
(5 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
==SoX scripts== | ==SoX scripts== | ||
− | Sample scripts included with SoX. Since SoX is developed mainly under Unix, these scripts are usually /bin/sh scripts. | + | Sample scripts included with SoX. Since SoX is developed mainly under Unix, these scripts are usually <code>/bin/sh</code> scripts. |
− | + | ;<code>audiogen</code> : Generate audio using the "synth" effect. | |
− | + | ;<code>crossfade.sh</code> : Crossfade two audio files. | |
− | + | ;<code>crossfade_cat.sh</code> : Crossfade two audio files into a single file. | |
− | + | ;<code>fmsim</code> : Make an audio file sound like its playing over an FM radio | |
− | + | ;<code>startrec.sh</code> : Start recording audio after detecting non-silence. | |
− | + | ;<code>testcd.sh</code> : Create audio files for a test cd. Useful for testing quality of audio equipment. | |
− | ==Example usage== | + | ==Usage== |
+ | ''Note: For sox, version 12.18.1.'' | ||
+ | |||
+ | Usage: [ gopts ] [ fopts ] ifile [ fopts ] ofile [ effect [ effopts ] ] | ||
+ | |||
+ | ;gopts: <code>-e -h -p -q -S -V</code> | ||
+ | ;fopts: <code>-r rate -c channels -s/-u/-U/-A/-a/-i/-g/-f -b/-w/-l/-d -v volume -x</code> | ||
+ | ;effect: <code>avg band bandpass bandreject chorus compand copy dcshift deemph earwax echo echos fade filter flanger highp highpass lowp lowpass mask mcompand noiseprof noisered pan phaser pick pitch polyphase rate repeat resample reverb reverse silence speed stat stretch swap synth trim vibro vol</code> | ||
+ | ;effopts: depends on effect | ||
+ | ;Supported file formats: <code>aiff al alsa au auto avr cdr cvs dat vms gsm hcom la lu maud mp3 nul ossdsp prc raw sb sf sl smp sndt sph 8svx sw txw ub ul uw voc vorbis vox wav wve</code> | ||
+ | |||
+ | ===Example usage=== | ||
The <tt>soxexam</tt> man pages recommend the following settings to [[wikipedia:Companding|compand]] the classical music work ''Also Sprach Zarathustra'' by Richard Strauss: | The <tt>soxexam</tt> man pages recommend the following settings to [[wikipedia:Companding|compand]] the classical music work ''Also Sprach Zarathustra'' by Richard Strauss: | ||
sox asz.aif aszc.aif compand 0.3,1 -90,-90,-70,-70,-60,-20,0,0 -5,0,0.2 | sox asz.aif aszc.aif compand 0.3,1 -90,-90,-70,-70,-60,-20,0,0 -5,0,0.2 | ||
Line 19: | Line 30: | ||
For a bunch of <code>*.aif</code> files, as [[tcsh]], enter: | For a bunch of <code>*.aif</code> files, as [[tcsh]], enter: | ||
foreach file (*.aif) | foreach file (*.aif) | ||
− | + | sox $file $file.aif compand 0.4,1 -90,-90,-70,-70,-60,-30,0,0 -5,0,0.2 | |
end | end | ||
wait | wait | ||
+ | |||
+ | ==Miscellaneous examples== | ||
+ | * Have Google Translate play back text: | ||
+ | wget -q -O- -U Mozilla "<nowiki>http://translate.google.com/translate_tts?q=hello+,+how+are+you?&tl=en-uk</nowiki>"|cvlc - |play -t wav - -t wav -t alsa | ||
+ | |||
+ | ==See also== | ||
+ | *[http://www.ardour.org/ Ardour] — a digital audio workstation. | ||
+ | *[http://www.sonicvisualiser.org/ Sonic Visualiser] — an application for viewing and analysing the contents of music audio files. | ||
==External links== | ==External links== | ||
*[http://sox.sourceforge.net/ SoX homepage] | *[http://sox.sourceforge.net/ SoX homepage] | ||
+ | *[http://www.edcox.net/research/ma/ma1-aiff.asp aiff/wav file formats] | ||
+ | ===Techniques=== | ||
+ | *[http://www.ohmpie.com/imageEncode Encoding an image to sound] | ||
[[Category:Linux Command Line Tools]] | [[Category:Linux Command Line Tools]] |
Latest revision as of 11:10, 28 October 2014
Sound eXchange, abbreviated SoX, is a free digital audio editor which is licensed under the GPL and distributed by Chris Bagwell through SourceForge. SoX is written in standard C, with a command-line interface.
Contents
SoX scripts
Sample scripts included with SoX. Since SoX is developed mainly under Unix, these scripts are usually /bin/sh
scripts.
audiogen
- Generate audio using the "synth" effect.
crossfade.sh
- Crossfade two audio files.
crossfade_cat.sh
- Crossfade two audio files into a single file.
fmsim
- Make an audio file sound like its playing over an FM radio
startrec.sh
- Start recording audio after detecting non-silence.
testcd.sh
- Create audio files for a test cd. Useful for testing quality of audio equipment.
Usage
Note: For sox, version 12.18.1.
Usage: [ gopts ] [ fopts ] ifile [ fopts ] ofile [ effect [ effopts ] ]
- gopts
-
-e -h -p -q -S -V
- fopts
-
-r rate -c channels -s/-u/-U/-A/-a/-i/-g/-f -b/-w/-l/-d -v volume -x
- effect
-
avg band bandpass bandreject chorus compand copy dcshift deemph earwax echo echos fade filter flanger highp highpass lowp lowpass mask mcompand noiseprof noisered pan phaser pick pitch polyphase rate repeat resample reverb reverse silence speed stat stretch swap synth trim vibro vol
- effopts
- depends on effect
- Supported file formats
-
aiff al alsa au auto avr cdr cvs dat vms gsm hcom la lu maud mp3 nul ossdsp prc raw sb sf sl smp sndt sph 8svx sw txw ub ul uw voc vorbis vox wav wve
Example usage
The soxexam man pages recommend the following settings to compand the classical music work Also Sprach Zarathustra by Richard Strauss:
sox asz.aif aszc.aif compand 0.3,1 -90,-90,-70,-70,-60,-20,0,0 -5,0,0.2
Here's what this terminal command does. It first takes the asz.aif file and outputs it as aszc.aif, subjecting it to the compand filter. The soxexam man pages explain the settings as follows: "The transfer function ("-90,...") says that very soft sounds between -90 and -70 decibels (-90 is about the limit of 16-bit encoding) will remain unchanged. That keeps the compander from boosting the volume on "silent" passages such as between movements. However, sounds in the range -60 decibels to 0 decibels (maximum volume) will be boosted so that the 60-dB dynamic range of the original music will be compressed 3-to-1 into a 20-dB range, which is wide enough to enjoy the music but narrow enough to get around the road noise. The -5 dB output gain is needed to avoid clipping (the number is inexact, and was derived by experimentation). The 0 for the initial volume will work fine for a clip that starts with a bit of silence, and the delay of 0.2 has the effect of causing the compander to react a bit more quickly to sudden volume changes."
For a bunch of *.aif
files, as tcsh, enter:
foreach file (*.aif) sox $file $file.aif compand 0.4,1 -90,-90,-70,-70,-60,-30,0,0 -5,0,0.2 end wait
Miscellaneous examples
- Have Google Translate play back text:
wget -q -O- -U Mozilla "http://translate.google.com/translate_tts?q=hello+,+how+are+you?&tl=en-uk"|cvlc - |play -t wav - -t wav -t alsa
See also
- Ardour — a digital audio workstation.
- Sonic Visualiser — an application for viewing and analysing the contents of music audio files.