Created
July 31, 2014 18:08
-
-
Save pgrandin/985946702604d662e9ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "$1" >> ~/.navit/speech.log | |
md5=`echo "$1" | md5sum -|awk '{print $1}'` | |
[ -d speech ] || mkdir speech | |
use_fallback=1 | |
if [ -f "speech/${md5}.mp3" ]; then | |
echo "[cache] Saying $1" | |
use_fallback=0 | |
else | |
echo "Saying : $1" | |
s=`echo $1|sed -e "s/ /+/g"` | |
wget -q -U Mozilla -O speech/${md5}.mp3 "http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=$s" | |
use_fallback=$? | |
fi | |
amixer set spotify 10%- | |
if [ $use_fallback -eq 0 ]; then | |
mpg123 speech/${md5}.mp3 || echo "$1" | festival --tts | |
else | |
espeak -s 130 --stdout -ven+f4 "$1"|aplay - | |
fi | |
amixer set spotify 10%+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment