Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome text-to-speech API doesn't work

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

like image 492
Eugenio Avatar asked May 22 '13 18:05

Eugenio


People also ask

How do I enable Text-to-Speech in Chrome?

Step 1: Turn on Select-to-speak Select Settings . At the bottom, select Advanced. In the "Accessibility" section, select Manage accessibility features. Under "Text-to-Speech," turn on Enable select-to-speak.

Is Google TTS free?

Text-to-Speech is priced based on the number of characters sent to the service to be synthesized into audio each month. You must enable billing to use Text-to-Speech, and will be automatically charged if your usage exceeds the number of free characters allowed per month.

What is the best Text-to-Speech extension for Chrome?

Which is the best text-to-speech Chrome extension for Google Drive? Speechify is a top choice for a text-to-speech plugin for Google Drive, largely due to its Immersive Reader function that helps users stay on track when reading documents, books, or papers.


4 Answers

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

like image 184
Don McCurdy Avatar answered Oct 02 '22 11:10

Don McCurdy


. . Hi, Eugenio.

. . This API is only available for extensions. You can port your logic to inside an extension (people would have to install it to use, of course), create an extension that exposes the functions to the "outside world" (people would still need to install the extension to use your app correctly) or simply use a client-side synthesizer (speak.js, for example).

. . You can use WebAudio API (or event tags) and calls to the Google Translate TTS endpoint, but that's not a Public API and it has no guarantees. It can simply stop working because of some limitation from Google, they can change the API or endpoints and yadda yadda. If it's only for testing, that'll probably do, but if it's a bigger project (or a comercial one), I strongly advise against that option.

. . Good luck.

like image 32
diego nunes Avatar answered Oct 02 '22 10:10

diego nunes


Today (October 2015) there's 55% devices that have Speech Synthesis API support: http://caniuse.com/#feat=speech-synthesis

Here's the example:

// Create the utterance object
var utterance = new SpeechSynthesisUtterance();
utterance.text = 'Hello, World!';

// optional parameters
utterance.lang = 'en-GB'; // language, default is 'en-US'
utterance.volume = 0.5;   // volume, from 0 to 1, default is 1
utterance.rate = 0.8;     // speaking rate, default is 1 

// speak it!
window.speechSynthesis.speak(utterance);
like image 40
Limon Monte Avatar answered Oct 02 '22 10:10

Limon Monte


Just to add some links because I also was lost finding the right information.

You can use the so called "speech synthesis api" of Chrome, see demo: https://www.audero.it/demo/speech-synthesis-api-demo.html

Further info:

  • Talking Web Pages and the Speech Synthesis API
  • Getting Started with the Speech Synthesis API
  • Using HTML5 Speech Recognition and Text to Speech

Hope that helps, and hope the links will survive the future.

like image 27
Avatar Avatar answered Oct 02 '22 11:10

Avatar