This demo no longer works due to changes with the Google Translate TTS API (which was not public to begin with, so this was bound to happen). The post remains here for archival purposes.
Update : Andufo shared the happy news that more languages are now available in the Google TTS service! I have added a new language selection drop-down for English, Spanish, French, German, Italian, and Hatian Creole.
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
Now multiple languages are supported, and it turns out
that the TTS web service is restricting the only available for short translations to English
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):
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
!
45 replies on “Google Text-To-Speech (TTS)”
Nice! smooth moves with
rel="noreferrer"
🙂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
[…] 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 […]
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.
[…] 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 […]
That would be even better with forvo.com pronunciations.
[…] Weston Ruter发现了一个Google官方并未宣布的文字转语音API,可以将任何你输入的文字实时转换成语音播放出来,是由一个女性的声音合成出来的。比如进入下面这个地址,教Google这个老外说“我爱谷奥”试试看: […]
[…] RuterはGoogleに限らず誰でもこの機能を呼び出せることに気づいた。 このTTS データが送られて来るところをFirebug […]
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.
[…] Additionally, Google Translate recently announced Text to Speech support, and Weston Ruter released a script that combines this with HTML5 audio. […]
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).
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!
Is it only in English ? waiting for Google tts in all languages ^___^
i like to make it say funny stuff
just tried this:
http://translate.google.com/translate_tts?tl=fr&q=Bonjour
It works too! (french, spanish, italian, german)
@andufo: Thank you!! I added a language selection drop-down.
Hi Weston, this is great (thank you for the post). I have 2 doubts, though:
1) is there any parameter to configure the typ of voice used in the TTS? (male, female, robot)
2) do you know if google is planning to release an official-open API for the TTS service?
@andufo, thanks. Not sure about either: There are no voice font parameters (gender, pitch, speed, etc.) that I am aware of. And I am not aware if Google is planning on supporting this TTS service as an official public API. We can only hope! I hope any such future API would also include the time indicies for each of the words in the audio so that a “read-along” app could be automated: http://weston.ruter.net/projects/html5-audio-read-along/
Check out JSonic which includes a Python TTS web service you can run in your own domain plus a JS lib for multichannel speech and sound. http://github.com/parente/jsonic
They’ve added a bazillion (ie, 27) new TTS languages: http://googletranslate.blogspot.com/2010/05/giving-voice-to-more-languages-on.html
There’s also a nice jQuery TTS plugin and API over at http://www.jtalkplugin.com. No download at the moment though 🙁
I have created a PHP class wrapper with features such as unlimited characters (google limits to 100). The class also includes methods to include javascript and play characters in real time without any visable player.
Based on:
* Jquery
– Jplayer
– Hotkey
* Googles TTS API
Check it out @ pkj’s developer blog:
http://pkj.no/content/googles-tts-api-power-php
This seems not to work anymore … anyone else?
… Yes it seems to work just fine (Windows, Google Chrome)
It does not work anymore since google enabled the support for other languages with a different system..
I’m on linux with google chrome and what i see in the page now is:
i want to add 2000 words, but it limit to 100 words is there any other API. Is there any possible ways
Works for me…
http://translate.google.com/translate_tts?tl=ja&q=%E3%81%AF%E3%81%98%E3%82%81%E3%81%BE%E3%81%97%E3%81%A6%E3%81%A9%E3%81%86%E3%81%9E%E3%82%88%E3%82%8D%E3%81%97%E3%81%8F%E3%81%8A%E3%81%AD%E3%81%8C%E3%81%84%E3%81%97%E3%81%BE%E3%81%99
btw. on Windows XP, running Chrome (4.1.249.1045 unknown (42898))
Try to type in:
lollilollilollilollilollilollilollilollilollilollilollilollilollilollilollilollilollilollilollilolli
Funny!
http://translate.google.com/translate_tts?tl=cn&q=????
I would like to hear the audio from chinese (CN) when I type in a word. The question is do they use some sort of pinyin code like putting a number at the end for the tone (yi1, yi2, yi3, yi4) or does the actual chinise character need to be typed in the address bar? How do they file their chinese words? Can they be accessed?
Hi, Sean.
http://translate.google.com/translate_tts?tl=zh_CN&q=%E4%BD%A0%E5%A5%BD%E3%80%82%E6%82%A8%E4%B9%9F%E5%8F%AF%E4%BB%A5%E8%AE%B2%E4%B8%AD%E6%96%87%E3%80%82
You can use Google Text-To-Speech in Chinese with ‘zh-CN’.
Please try it.
If you are living in Taiwan, you should use ‘zh-TW’.
Sorry.
I havd a mistake. Please use ‘zh_CN’ or ‘zh_TW’ as language code if you use Chinese.
And you can use the original characters after ‘q=’ .
Hi, pretty cool workaround.
I’m giving it a try but doesn’t work on Google Chrome under Linux. Looking at the request I can see your sending the referer, so Google throws a 404.
Anybody knows if they plan to publish the tts libraries to use in a PC program? that would be awesome for me.. TTS voices a either bad sounding or too expensive.
Hi all,
I am studying chinese language and want to be able to download sounds so I can then upload them to my flash card player. Is anyone able to help show me how I would maybe enter either chinese characters/pinyin somewhere and then be able to download the mp3?
Would really appreaciate your help – I’m no coder by the way.
Cheers
Hi, thanks for sharing. Would you please kindly let me know how I can use this in a WordPress post? Do you use plugins to allow js in the post? Any help would be highly appreciated.
Jack:
The Google TTS API is not intended for public use. However I would recommend the SoundGecko listen button.
This can also be used in IE9+ by implementing the element and setting the src to the URL.
sorry, my post got cut off…. use the AUDIO element
I have been using the google translate_tts for 6 or 8 months now calling it from wget to create a .mp3. workED great until 2 days ago (july 29, 2015). google has put a captcha on it when you call it from a web browser and it returns a 503 service not available when called from wget. I haven’t determined if its temporary from overuse (i use it about 100x/day i would guess), but it seems permanent (ie it doesn’t come back on next day).
frowny face.
anyone know a workaround? or is this service no longer unavailable as a free webservice?
This service was never public, so it was liable to be shut off at any time.
append “&client=t” to the url:
http://translate.google.com/translate_tts?tl=en&q=Hello%2C+World!&client=t
To answer skyrunkeystone’s question:
append “&client=t” to the url.
http://translate.google.com/translate_tts?tl=en&q=Hello%2C+World!&client=t
Hi Samuel, this works for me after adding &client=t. What’s means this parameter thanks
Thank you, thank you Samuel! Using that additional parameter I was able to fix a script that had stopped working that announces the currently playing song in my playlist.