I'm having a weird issue with the web speech api. I've set up some code to speak a string of text - very rarely, it speaks it in a normal voice ("Alex" from Dictation and Speech Settings in Mac OS X). But usually, it speaks in the voice "Albert".
I'm looking at the w3c web speech api listed here:
https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#dfn-ttsgetvoices
and there is an interface called
SpeechSynthesisVoiceList {}
I am trying to access this functionality, but I can't.
How would I access this voice list? I'm using chrome canary, and I've tried numerous methods of doing this. What I would expect to work would be:
var u = new SpeechSynthesisUtterance();
console.log(u.getVoices());
or
var u = new SpeechSynthesisVoiceList();
console.log(u);
I've also run:
console.log(window)
and I see numerous things regarding the web speech api and speech synthesis, but nothing about voices.
You should use speechSynthesis.getVoices()
to get a list of all voices. This is an output from Google Chrome 33:
[{
"default": true,
"localService": false,
"lang": "en-US",
"name": "Google US English",
"voiceURI": "Google US English"
}, {
"default": false,
"localService": false,
"lang": "en-GB",
"name": "Google UK English Male",
"voiceURI": "Google UK English Male"
}, {
"default": false,
"localService": false,
"lang": "en-GB",
"name": "Google UK English Female",
"voiceURI": "Google UK English Female"
}, {
"default": false,
"localService": false,
"lang": "es-ES",
"name": "Google Español",
"voiceURI": "Google Español"
}, {
"default": false,
"localService": false,
"lang": "fr-FR",
"name": "Google Français",
"voiceURI": "Google Français"
}, {
"default": false,
"localService": false,
"lang": "it-IT",
"name": "Google Italiano",
"voiceURI": "Google Italiano"
}, {
"default": false,
"localService": false,
"lang": "de-DE",
"name": "Google Deutsch",
"voiceURI": "Google Deutsch"
}, {
"default": false,
"localService": false,
"lang": "ja-JP",
"name": "Google 日本人",
"voiceURI": "Google 日本人"
}, {
"default": false,
"localService": false,
"lang": "ko-KR",
"name": "Google 한국의",
"voiceURI": "Google 한국의"
}, {
"default": false,
"localService": false,
"lang": "zh-CN",
"name": "Google 中国的",
"voiceURI": "Google 中国的"
}, {
"default": false,
"localService": true,
"lang": "",
"name": "native",
"voiceURI": "native"
}]