Difference between revisions of "SoX"

From Christoph's Personal Wiki
Jump to: navigation, search
(External links)
Line 25: Line 25:
 
==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]
  
 
[[Category:Linux Command Line Tools]]
 
[[Category:Linux Command Line Tools]]

Revision as of 01:28, 14 April 2007

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.

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.

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

External links