speechSynthesis timing
-
farjo last edited by
I am developing a website using SST via speechSynthesis. It is working on Chrome however I would like to be able to recommend Opera as well.
Take a look at this page using Opera and compare with Chrome or Safari: http://codepen.io/matt-west/details/wGzuJ
In Chrome/Safari the 'Voice' select box has the voices of various languages to choose from, but in Opera there is only 'native'. This means that whilst it will speak "It works in English" correctly, a foreign phrase e.g. "Creo que no funciona" gets read as if they are English words (e.g. que pronounced "queue" instead of "ke").
My question is twofold:
Whilst in Opera ('speechSynthesis' in window) returns true, can it work for languages other than English?If so what is the timing of the getVoices method? The above mentioned web page uses this code:
// Fetch the list of voices and populate the voice options. function loadVoices() { // Fetch the available voices. var voices = speechSynthesis.getVoices(); // Loop through each of the voices. voices.forEach(function(voice, i) { // Create a new option element. var option = document.createElement('option'); // Set the options value and text. option.value = voice.name; option.innerHTML = voice.name; // Add the option to the voice selector. voiceSelect.appendChild(option); }); } // Execute loadVoices. loadVoices(); // Chrome loads voices asynchronously. window.speechSynthesis.onvoiceschanged = function(e) { loadVoices(); };
This calls speechSynthesis.getVoices() after the event window.speechSynthesis.onvoiceschanged, as Chrome loads the voices asynchronously.
Does Opera load the voices in a different way? Does Opera use a different event?
Thank you for reading such a long post and for any (helpful!) replies.