[asterisk-dev] default format for sounds

Philipp Kempgen philipp.kempgen at amooma.de
Mon Sep 22 05:27:21 CDT 2008


Philipp Kempgen schrieb:

> I would add a simple script to the tarball which could be used to
> convert (sox) WAV to ALaw or ALaw to GSM (or any other conversion).
> So if a user wants GSM they can have it with a single simple
> command.

--------------cut-----
#!/bin/sh

# Recursively converts all *.wav files in the current directory
# to .alaw

# or:
#dir=/var/lib/asterisk/sounds/
#cd ${dir}

if [ ! -x /usr/bin/sox ]
then
	echo "/usr/bin/sox not found!"
	echo ""
	exit 1
fi

echo ""
echo "Converting all *.wav in ${dir} to *.alaw ..."
echo "-----------------------------------------------------------------"
cnt=0
for i in `find . -name '*.wav' -print | sort`
do
	base=$(dirname $i)/$(basename $i .wav)
	echo "${base}"
	sox -t wav ${i} -r 8000 -c 1 -w -t al ${base}.alaw
	chmod a-x,a+r,go-w ${i} ${base}.alaw
	cnt=$(( $cnt + 1 ))
done
echo "-----------------------------------------------------------------"
echo "Done. ${cnt} files converted."
echo ""

--------------cut-----


   Philipp Kempgen

-- 
http://www.das-asterisk-buch.de  -  http://www.the-asterisk-book.com
Amooma GmbH - Bachstr. 126 - 56566 Neuwied  ->  http://www.amooma.de
Geschäftsführer: Stefan Wintermeyer, Handelsregister: Neuwied B14998
-- 



More information about the asterisk-dev mailing list