Use Google for Text-to-Speech Translations in the Browser
Google Translate has rolled a out several new features, and one of them lets you hear your translated English text spoken by a computerized voice.
For maximum cross-browser compatibility, Google Translate embeds text-to-speech mp3s using Flash. However, web developer Weston Ruter has already figured out how to grab the audio files for use on any webpage and uses the HTML5 audio tag to embed them in his demo.
The new Translate audio tools generate (rough) pronunciations of whatever text is entered the end of this URL:
Just pass along the phrase you’d like to hear instead of “text” at the end of the URL and you’ll get an mp3 file like this one. You may have to try a couple of different browsers to get a translated file that works flawlessly. (It works especially well in Chrome, which is not surprising.) With a tool like this, the urge to get silly is irresistible, as Twitter user Brad Cohen has done by feeding Google Translate some Justin Timberlake lyrics.
Take one of these mp3s and embed it using HTML5′s audio tag — as Ruter has done on his site — and you’ve got an instant, mobile translation service that’ll work on the iPhone, Android and other Webkit-based mobile browsers.
The iPhone handles Ruter’s example quite well, though the interface is slightly awkward — Mobile Safari brings up a new overlay page to play the audio. Still, despite a few quirks, having a text-to-speech generator available on the web offers developers quite a few browser-based possibilities for a task previously relegated to desktop apps, or, otherwise, full-fledged mobile apps like the translation tools available for the iPhone and Android devices.
The biggest catch at the moment is that Google Translate’s text-to-speech feature is only available in English. But as with most Google services, the initial limitations are likely to disappear before too long.
Also part of the announcement, Google Translate now performs translations as you type — no need for the “translate” button — and there’s also a new “Show romanization” that lets you read the text written phonetically in English. This works with all non-Roman languages except for Hebrew, Arabic and Persian.