For window.speechSynthesis.speak() to render audio output in the Chromium browser, you need to set speech-dispatcher and start the browser using the --enable-speech-dispatcher flag.
onvoiceschanged event handler and window.speech.synthesis.getVoices() must be called to fill out the list of available votes. The API is not simple; .getVoices() may need to call SpeechSynthesisVoice objects SpeechSynthesisVoice to populate the array returned by .getVoices() .
Note that there is a possibility that .speak() calls will be queued and not displayed as audio output, which is not immediately visible; calling window.speechSynthesis.cancel() clears the queue where the audio output may be unexpectedly displayed.
Then you can use window.speechSynthesis.speak() .
For some time we tried to get the default SSML parsing in the Chromium browser for * nix; without using an external web service that requires some form of EUA or is not free, as in beer.
The list of entities that were contacted and the questions asked to achieve this are quite long, for example
Firefox on * nix also does not parse SSML.
Perhaps with great interest from users as a whole, we can finally enable this feature by default.
Although there are workarounds for parsing SSML without using an external web service; this first link below is still unanswered; although it includes php code that calls binary using shell_exec() following $_POST on the local server
Please note that there are several errors with the current implementation of the Web Speech API, in particular, that changing the volume property in SpeechSynthesisUtterance does not affect the audio output on both Chromium and Firefox
There is also an error when using .pause() and .resume() , which occurs when trying to programmatically analyze the <break> SSML element
An alternative to using the apparently dead Web Speech API is speak.js , which was created by porting espeak to JavaScript or meSpeak.js , which is fork speak.js . espeak-ng now actively supported, for example, using a modified version of meSpeak.js
or using online dictionaries that serve for voice-reflecting voice files
Interestingly, after the publication of the answer "gstatic", the dictionary no longer served the audio files.
Fortunately we have
This is an application for Android, Android and iOS for collecting voice donations for the Common Voice project.
which is quite active.
We can also use Native Message for Chromium / Chrome and Firefox to interact with the native shell and invoke the binary itself
this code achieves the expected result with minimal modification using Native Messaging
or as a drastic measure, change the binary
(opinion supported by facts)
There is a significant market for web services for speech synthesis technologies, both in their generation ("[L] yrebird") and recognition - for profit, for example, "* lexa"; "* Olly"; (* bm) "* atson * luemix"; (* oogle) "* ctions"; and etc.
Open source developers should continue their efforts to support open source speech synthesis technologies (FOSS, FLOSS) in open source browsers. If we want these technologies to be implemented in default browsers, open source developers need to compose code for this to happen.