TTS (Text to Speech), pico2wave alternative, command line, linux

Install prerequisites:
sudo apt-get install mplayer
Put text in variable:
echo="A snow-white dove in the pitch-black night. A rain drop falls from tremendous heights"
Encode and download using Google's Text To Speech service:
curl -s https://translate.google.com/translate_tts?ie=UTF-8\&q=$(echo "$echo"|sed "s/ /%20/g")\&tl=en\&client=tw-ob -H 'Referer: http://translate.google.com/' -H 'User-Agent: stagefright/1.2 (Linux;Android 5.0)' > tts.mp3
Play the file:
mplayer tts.mp3

No comments: