Sunday, January 6, 2013

Utter

Looking for a basic text-to-speech (tts) Python module with language conversion and mp3 playback and comes with a Heroku web app? Try utter, https://github.com/rsgalloway/utter.
% pip install utter
It's super easy to use from the command line:
% utter "this is a test"
and to convert to, say, German:
% utter "I am a Berliner" -t de
The Python API is just a easy to use:
>>> import utter
>>> utter.play("I love utter", target="ja")
The only requirement for translation is that you have a Google API Key, which you can get from the Google APIs Console.

I've also written a simple Instapaper Python API, that when combined with utter, you can use to read saved articles back to you, for example on your commute or a road trip. You can even have it translated to another language if you want, for example Italian:
>>> import utter
>>> for m in marks:
...     utter.play(m.text, target="it")
Utter also comes with a "web" branch that's ready to deploy to heroku. The nice thing about the web app is that it takes advantage of the built-in speach-to-text feature of Chrome, so you can get automatic spoken language translation on the fly. Just click on the language menu to choose the target language, then click the mic to start.


You can play with it here: http://utter.herokuapp.com. Sorry, Chrome only, and I've capped the language translation at 2M characters per day.

Disfrute!