2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00
fhem-mirror/fhem/contrib/voip2fhem/voip2fhem_create_txt2gsm
martinhaas 12db6bfe8f voip2fhem added to conrib/
git-svn-id: https://svn.fhem.de/fhem/trunk@126 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2007-12-21 12:43:45 +00:00

80 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# weak machines need a long time to create a gsm-Voicefile.
# this script searches for an existing voice and if not it will create it
# Martin Haas 071217
# The NSLU2 needs e.g. 5min to convert the word "Aussentemperatur"
# Call this file (on a faster machine :-) ) with the words to convert
# e-g voip2fhem_create_txt2gsm "This is a test"
# otherwise this script creates number from -20 to +90
# hint: cat examplefile | while read line; do ./voip2fhem_create_txt2gsm "$line"; done
location=/var/tmp/voip2fhem # later the owner must be asterisk.asterisk
[[ ! -d $location ]] && { mkdir $location; chown asterisk.asterisk $location; }
###################################################
###
CreateVoices()
{
lvoice="$location/$(echo $voice | sed 's/[ ,.:]/_/g').gsm"
echo $lvoice
if [ ! -f $lvoice ]
then
espeak -v de -s 120 -w /tmp/asterisk.wav "$voice"
sox /tmp/asterisk.wav -r 8000 -c 1 $lvoice resample -ql
fi
}
###################################################
## main
if [[ $1 ]]
then
voice=$1
CreateVoices "$voice"
else
for i in `seq -20 90 ` -0
do
if [ ${i:0:1} == - ]
then
m="minus $i" ## negativ temperature
voice=$(echo $m | sed -e 's/-//g' -e 's/\./,/g') # English people: change , against .
else
voice=$(echo $i | sed 's/\./,/g') # English people: change , against .
fi
CreateVoices "$voice"
origvoice=$voice
for k in `seq 0 9`
do
voice="$origvoice,$k" # English people: change , against .
CreateVoices "$voice"
voice=$origvoice
done
done
fi