When using the IVR, you’ll encounter two sound formats: CAL and WAV.
• CAL files can be played by the IVR, but not by Windows
• WAV files can be played by Windows, but not by the IVR
SOX (Sound Exchange) is an open-source tool for converting sound file formats.
It can be used to convert .cal files to .wav files and the other way around.
Since it is a command-line tool, it can be used from within scripts.
The program can be found here: http://sourceforge.net/projects/sox/
SOX contains built-in support for the CAL format.
Since it calls this format “LA” (reverse ALaw) it won’t recognize the “.cal” extension.
Therefore we have to specify the file format ourselves using the “–t la” argument.
Since CAL files don’t contain a header, we also have to specify the following parameters:
• “-r 8000” for a sample rate of 8Khz
• “-c 1” to set the number of channels to 1 (i.e. mono).
CAL to WAV
sox –t la –r 8000 –c 1 inputfile.cal outputfile.wav
WAV to CAL
sox inputfile.wav –t la –r 8000 –c 1 outputfile.cal
Playing CAL files
Using the “-d” command, you can play a .cal file:
sox -t la –r 8000 –c 1 test.cal -d
Converting to uncompressed PCM WAV files
If you need a .wav file which uses uncompressed PCM encoding, you can use the following command:
sox –t la –r 8000 –c 1 inputfile.cal -t wav -e signed-integer -r 8000 -c 1 outputfile.wav
These .wav files are larger than the regular .wav files, but are required by some tools.
Combining single-channel CAL files into stereo WAV
It is possible to combine two single-channel recordings into a stereo output file:
sox -t la -c 1 -r 8000 customer.cal -t la -c 1 -r 8000 agent.cal –channels 2 –combine merge output.wav mixer 1,0,0,1
For more sox options, please read the documentation at http://sox.sourceforge.net