4 ms·
I'm a little surprised to have not seen any mention of the Speech Synthesis API (https://caniuse.com/#feat=speech-synthesis https://caniuse.com/#feat=speech-syn
by kevincennis 7y ago
I'm a little surprised to have not seen any mention of the Speech Synthesis API (https://caniuse.com/#feat=speech-synthesis https://caniuse.com/#feat=speech-synthesis).
It's supported almost everywhere that the Web Audio API is.
- est31 7y agoFor me, running window.speechSynthesis.getVoices() in the web console of both Firefox and Chromium results in an empty list. Any idea how to populate it? Using ubuntu packages of Firefox/Chromium. Nor does this demo work in any of the two: http://mdn.github.io/web-speech-api/speak-easy-synthesis/ http://mdn.github.io/web-speech-api/speak-easy-synthesis/
- Etheryte 7y agoOn macOS, the returned list contains the built-in operating system voices (about 50) and some additional ones by Google (roughly 20). The spec [1] says the voices made available are entirely up to the browser. Doesn't really answer your question, but at least some additional insight. [1] https://w3c.github.io/speech-api/#dom-speechsynthesis-getvoices https://w3c.github.io/speech-api/#dom-speechsynthesis-getvoi...
- est31 7y agoThanks for confirming that I'm looking at the right list!
- jajag 7y agoIt can take a while for the full voice list to load after speech synthesis is initialized on the page - try calling getVoices() again after a small delay.
- codegladiator 7y agoThis worked. First time I got an empty array. Second time I see an array with 47 items.
- masswerk 7y agoThis project is older (2011) than the Web Speech API. (However, one of the scenarios for a version 2.0 was to implement the same API, additionally to the 'native' one, to be used as a fallback solution. While I actually had implemented this already, I don't think it may be that useful, while it increases file size quite a bit.) Edit: Viable points for this may be still a) reliable performance and interaction, and b) known voices (even, if they are a bit robotic), c) use in offline applications. Using an analyser node for animations may be yet another.