Hacker News new | ask | show | jobs
by est31 2509 days ago
For 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/
2 comments

On 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-getvoi...

Thanks for confirming that I'm looking at the right list!
It 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.
This worked. First time I got an empty array. Second time I see an array with 47 items.