convert wav files to gsm for use with asterisk / convert many mp3 to gsm

byo71's picture
Asterisk Programming | Communications

I have to use this all the time to convert my wav files to gsm for use in asterisk.

sox foo.wav -r 8000 -c1 foo.gsm resample -ql

make sure you have sox installed

# apt-get install sox

-------------------------------------------------
CONVERT *.MP3 to *.GSM


for I in $(ls -1 *.mp3)
do
NAME=$I
echo "Converting from mp3.wav"
mpg123 -w "$NAME.wav" "$NAME"
echo "Converting from wav to gsm"
sox -t wav "$NAME.wav" -r 8000 -c1 -t gsm "$NAME.gsm" resample -ql
echo "output filename: $NAME.gsm"
done

Not sure if this works when there are spaces in the file names...

byo71's picture

convert mp3 to wav using mpg123

mpg123 -w destination.wav source.mp3