Chrome text-to-speech API doesn't work

Eugenio picture Eugenio · May 22, 2013 · Viewed 10.2k times · Source

I'm trying the chrome text-to-speech API but even the demo provided by google https://developer.chrome.com/trunk/extensions/examples/extensions/ttsdemo/ttsdemo.html doesn't work for me, I can't hear any sound, do you?

I don't think it is a problem of my browser because google.translate.com (which I guess is based on the same technology) works for me if I try the listening mode.

Any idea?

Thanks

Answer

Don McCurdy picture Don McCurdy · Jun 11, 2014

As of Chrome 33, Chrome's speech synthesis API is available in JavaScript.

Quick example:

window.speechSynthesis.speak(
   new SpeechSynthesisUtterance('Oh why hello there.')
);

Details:

HTML5 Rocks: Introduction to the Speech Synthesis API