Weston Ruter

Web application developer in Portland, Oregon

Google Text-To-Speech (TTS)

By

Google Translate announced the ability to hear translations into English spoken via text-to-speech (TTS). Looking at the Firebug Net panel for where this TTS data was coming from, I saw that the speech audio is in MP3 format and is queried via a simple HTTP GET (REST) request: http://translate.google.com/translate_tts?tl=en&q=text. Google Translate notes that the speech is only available for short translations to English, and it turns out that the TTS web service is restricting the text to 100 characters. Another restriction is that the service returns 404 Not Found if the request includes a Referer header (presumably one that is not for translate.google.com).

In spite of the limitations of the web service which certainly reflect the intention that the web service is only to be used by Google Translate, thanks to the new HTML5's Audio element and rel="noreferrer", the service may be utilized by client-side web applications like following (Google Chrome 4 recommended):

Google Text-To-Speech (TTS)

I am really excited at the prospect of text-to-speech being made available on the Web! It's just too bad that fetching MP3s on an remote web service is the only standard way of doing so currently; modern operating systems all have TTS capabilities, so it's a shame that web apps and can't utilize them via client-side scripting. I posted to the WHATWG mailing list about such a Text-To-Speech (TTS) Web API for JavaScript, and I was directed to a recent thread about a Web API for speech recognition and synthesis.

Perhaps there is some momentum building here? Having TTS available in the browser would boost accessibility for the seeing-impaired and improve usability for people on-the-go. TTS is just another technology that has traditionally been relegated to desktop applications, but as the Open Web advances as the preferred platform for application development, it is an essential service to make available (as with Geolocation API, Device API, etc.). And besides, I want to build TTS applications and my motto is: If it can't be done on the Open Web, it's not worth doing at all!

Comments

  1. Paul Irish

    Nice! smooth moves with rel="noreferrer" :)

  2. Clochix

    You can easily create a TTS web service with existing softwares. Here’s an example (sorry, in french) of my own TTS-WS that I call from a Firefox Ubiquity command : http://www.clochix.net/post/2009/03/14/Et-en-plus-il-parle

  3. Ajaxian » Text to Speech via HTML5 Audio

    [...] Ruter has created a nice mashup that marries HTML5 Audio support in modern browsers with the new Google Translate API that does text to speech (for them): Recently [...]

  4. Dave

    They should do this for the pronunciation guides after names on Wikipedia. I have no idea what those crazy IPA symbols are supposed to represent, but I’m guessing they can be easily translated to speech.

  5. The Unofficial Google Text-To-Speech API

    [...] no official API for the text-to-speech service. But Weston Ruter noticed that anyone can access the service in the same way Google does: “Looking at the Firebug Net [...]

  6. Miguel

    That would be even better with forvo.com pronunciations.

  7. Google 文字转语音 API 曝光,让 Google 对你说话 | 谷奥——探寻谷歌的奥秘

    [...] Weston Ruter发现了一个Google官方并未宣布的文字转语音API,可以将任何你输入的文字实时转换成语音播放出来,是由一个女性的声音合成出来的。比如进入下面这个地址,教Google这个老外说“我爱谷奥”试试看: [...]

  8. Googleのテキスト読み上げ非公式API発見

    [...] RuterはGoogleに限らず誰でもこの機能を呼び出せることに気づいた。 このTTS データが送られて来るところをFirebug [...]

  9. Chris

    Here is a quick ubiquity hack to have the Google translator speak to you. In order to prevent it from trying to speak after every character, I required that the last character is a period, a forward slash(/) or a question mark before it will say the phrase. Try something like: Google is amazing.

    Just a thought.

    CmdUtils.CreateCommand({
    	names: ["say"],
    	arguments: [{role: "object",
    		nountype: noun_arb_text,
    		label: "your shout"}],
    	preview: function( pblock, arguments ) {
    		var text = arguments.object.text;
    		if(text.match(/[\/\.\?]$/)) {
    			var msg = 'Test';
    			pblock.innerHTML = msg;
    		}
    	},
    });
  10. Reach a Larger Audience with Content Translation Tools

    [...] Additionally, Google Translate recently announced Text to Speech support, and Weston Ruter released a script that combines this with HTML5 audio. [...]

  11. Earnest7

    Thx for info. Has anybody been able to use the TTS web service outside the box? — I mean content outside the text box that is linked some way. We are a group working to make language learning available on the global web (http://elguides.cc/resources.html).

  12. Eric

    Has anyone created a website form where the submit button gets sent off using some service/code that results in a telephone call using the text to speech technology?

    I’m in need of this for a website I’m building. Can someone point me to code or a free service I can use to accomplish this?

    Thanks!

  13. Nehad

    Is it only in English ? waiting for Google tts in all languages ^___^

  14. billy

    i like to make it say funny stuff

Leave a Comment