This is an old question. The last recent solution, and the most effective is
curl 'https://translate.google.com/translate_tts?ie=UTF-8&q=hello&tl=en&tk=995126.592330&client=t' -H 'user-agent: stagefright/1.2 (Linux;Android 5.0)' -H 'referer: https://translate.google.com/' > google_tts.mp3
and it is largely discussed here.
This solution (that may break in future), is implemented in the python library gTTS, that wraps the api in a useful way, so you can specificy the language, the text and write ou the file easily:
>> from gtts import gTTS
>> from tempfile import TemporaryFile
>> tts = gTTS(text='Hello', lang='en')
>> f = TemporaryFile()
>> tts.write_to_fp(f)
>> f.close()
NOTE. If we consider the opposite: Speech to Text, recently Google has released the Cloud Speech API that makes use of Machine Learning, it supports more languages, and it's the official api for speech recognition.
By the way, today there are a lot of other platforms doing this, and probably better that the TTS web service. Microsoft has a Speech API as part of their new cognitive systems, and it's free up to 5000 queries/month. IBM Watson Text To Speech API is extremely powerful and recently introduced Expressive Synthesis that is how to synthesize emotions in the voice. All these cloud api uses https://www.w3.org/TR/speech-synthesis/ as markup language to define the text to speech, that is far much more expressive than using simple unlabeled text.