Saturday, November 13, 2010

Codec2 Bash Scripts

Here's a bash script to round-trip a 8000Hz, 16-bit signed raw audio file through codec2. It takes the input file name and output file name as arguments:

TFILE="/tmp/$(basename $0).$$.tmp"
$CODEC2_HOME/c2enc $1 $TFILE
$CODEC2_HOME/c2dec $TFILE $2

Here's a sox command to get a wav file (or whatever) into the proper raw format for codec2:
sox input.wav -r 8000 -t raw -s -2 output.raw

No comments:

Post a Comment