SoX
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.
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