Converting Recorded Sounds For Use By Asterisk

You've just recorded a fabulous audio file to use with Asterisk in your IVR menu but you realize that Asterisk does not use normal ADPCM ".wav" format audio for the Playback or Background applications. Not to worry. The SOund eXchange (SOX) application that comes with CentOS can be used to convert to the proper format. The following command should do the trick:

     sox ivr-in.wav -r 8000 -c 1 -s -w ivr-out.wav resample -ql

It uses the resample filter to convert the input ".wav" file to single channel, 16-bit sound at a rate of 8000 samples per second. Just what Asterisk needs. Mind you, you'll probably get better results if you record your original ".wav" file in 16 bit, 8000 Hz, mono.

In IVR menus, excessive changes in volume or voices that are too quiet to understand are not a good thing. Normalizing the volume to a standard level and reducing volume fluctuations is called dynamic range compression. Using the sox compand filter, you can easily perform dynamic range compression on your sound files. Just remember to make sure to employ the compand filter before you resample the sound, so as to preserve as much quality as possible.

Here is an example of how to perform some appropriate dynamic range compression and normalization:

     sox ivr-in.wav -r 8000 -c 1 -s -w ivr-out.wav lowpass 4000 \
         compand 0.02,0.05 -60,-60,-30,-10,-20,-8,-5,-8,-2,-8 -8 -7 0.05 \
         resample -ql