#!/bin/bash
#
# Recursively convert all .wav files to alaw and gsm for use with Callweaver
#
# $Id: wav2pbx.sh 122 2006-02-15 04:34:57Z dswarbrick $

for file in `find . -name \*.wav`; do
        echo $file
        sox -V $file -t raw -s -r 8000 -c 1 -w `echo $file|sed -e s/\.wav$/.sln/` resample -ql;
        sox -V $file -t raw -U -r 8000 -c 1 -b `echo $file|sed -e s/\.wav$/.ulaw/` resample -ql;
        sox -V $file -t raw -A -r 8000 -c 1 -b `echo $file|sed -e s/\.wav$/.alaw/` resample -ql;
        sox -V $file -t gsm -r 8000 -c 1 -b `echo $file|sed -e s/\.wav$/.gsm/` resample -ql;
done
