Text to Speech API not working

I'm trying to use the chrome interface to convert text to speech, but even the demo provided by Google https://developer.chrome.com/trunk/extensions/examples/extensions/ttsdemo/ttsdemo.html does not work for me, I don’t hear any sound, right?

I don’t think this is my browser problem because google.translate.com (which I believe is based on the same technology) works for me if I try the listening mode.

Any idea?

thanks

+6
source share
4 answers

., Hello, Eugenio.

., This API is available only for extensions. You can transfer your logic to an internal extension (people would have to install it for use, of course), create an extension that provides functions to the "outside world" (people still need to install the extension to use your application correctly) or just use a client synthesizer ( speak.js , for example).

., You can use the WebAudio API (or event tags) and calls to the TTS Google Translate endpoint, but it is not a public API and has no guarantees. It may just stop working due to some restrictions from Google, they can change the API or endpoints and yadda yadda. If this is for testing only, it will probably be, but if it is a larger project (or commercial), I highly recommend this option.

., Good luck.

+1
source

As with Chrome 33, the JavaScript API for speech synthesis is available in JavaScript.

Quick example:

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

More details:

HTML5 Rocks: Introduction to the Speech Synthesis API

+9
source

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

Here is an 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); 
+1
source

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

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

Additional Information:

Hope this helps, and hope the links survive in the future.

+1
source

Source: https://habr.com/ru/post/945622/


All Articles