Google text-to-speech in MP3 Format via the Command Line
The function will take a string and create an MP3 of the string being spoken and named after the first 15 characters of the string:
t2s() { wget -q -U Mozilla -O $(tr ' ' _ <<< "$1"| cut -b 1-15).mp3 "http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=$(tr ' ' + <<< "$1")"; }
t2s "Hello reader!"
Produces the following:
ls -lh Hello_reader\!.mp3
-rw-r--r-- 1 westlund staff 4.5K Nov 3 13:42 Hello_reader!.mp3
Pretty slick. One thing to watch out for is that Google can flag your requests and unusual, if the alias is failing try launching the URL in your browser and see if it brings up a CAPTCHA.