audio conversion tools scripts for sounds and music on hold files

git-svn-id: svn://192.168.202.10@954 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
frankw
2008-09-18 09:23:46 +00:00
parent 0b29642e2e
commit fc3beb6ce4
2 changed files with 65 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#! /bin/bash
cd /var/lib/asterisk/sounds/
if [ -f /var/lib/asterisk/sounds/$1.mp3 ] ; then
sox -w -s $1.mp3 -r 8000 -c 1 $1.wav
sox $1.wav -t gsm -r 8000 -b -c 1 $1.gsm
sox $1.wav -t ul -r 8000 -b -c 1 $1.ul
sox $1.wav -t al -r 8000 -b -c 1 $1.al
else
if [ -f /var/lib/asterisk/sounds/$1.wav ] ; then
cp -f $1.wav ___$1.wav
sox -w -s ___$1.wav -r 8000 -c 1 $1.wav
rm -f ___$1.wav
sox $1.wav -t gsm -r 8000 -b -c 1 $1.gsm
sox $1.wav -t ul -r 8000 -b -c 1 $1.ul
sox $1.wav -t al -r 8000 -b -c 1 $1.al
else
if [ -f /var/lib/asterisk/sounds/$1.gsm ] ; then
sox -w -s $1.gsm -r 8000 -c 1 $1.wav
sox $1.wav -t ul -r 8000 -b -c 1 $1.ul
sox $1.wav -t al -r 8000 -b -c 1 $1.al
fi
fi
fi
@@ -0,0 +1,39 @@
#! /bin/bash
if -f /var/lib/asterisk/mohmp3/$1.mp3; then
cd /var/lib/asterisk/mohmp3/
sox -w -s $1.mp3 -r 8000 -c 1 $1.wav
sox $1.wav -t gsm -r 8000 -b -c 1 $1.gsm
sox $1.wav -t ul -r 8000 -b -c 1 $1.ul
sox $1.wav -t al -r 8000 -b -c 1 $1.al
mkdir ../orig-mp3
mv -f *.mp3 ../orig-mp3/
mkdir ../quiet-mp3
cd ../quiet-mp3
cp ../mohmp3/$1.wav full_$1.wav
sox full_$1.wav $1.wav vol 0.25
sox $1.wav -t gsm -r 8000 -b -c 1 $1.gsm
sox $1.wav -t ul -r 8000 -b -c 1 $1.ul
sox $1 -t al -r 8000 -b -c 1 $1.al
rm -f full_*.wav
else
if -f /var/lib/asterisk/orig-mp3/$1.mp3; then
cd /var/lib/asterisk/mohmp3/
cp /var/lib/asterisk/orig-mp3/$1.mp3 /var/lib/asterisk/mohmp3/
sox -w -s $1.mp3 -r 8000 -c 1 $1.wav
sox $1.wav -t gsm -r 8000 -b -c 1 $1.gsm
sox $1.wav -t ul -r 8000 -b -c 1 $1.ul
sox $1.wav -t al -r 8000 -b -c 1 $1.al
rm -f $1.mp3
mkdir ../quiet-mp3
cd ../quiet-mp3
cp ../mohmp3/$1.wav full_$1.wav
sox full_$1.wav $1.wav vol 0.25
sox $1.wav -t gsm -r 8000 -b -c 1 $1.gsm
sox $1.wav -t ul -r 8000 -b -c 1 $1.ul
sox $1 -t al -r 8000 -b -c 1 $1.al
rm -f full_*.wav
else
echo -e "Syntax $0 filename"
fi
fi