How to use speech synthesizer

An example showing how to use speech synthesizer in Tizen 2.3.
var voices = speechSynthesis.getVoices();
for (var i = 0; i < voices.length; i++) {
  if (voices[i].lang === 'en_US') {
    var voice = voices[i];
    break;
  }
}

var text = 'Hello world!';
var speech = new SpeechSynthesisUtterance(text);
speech.voice = voice;
window.speechSynthesis.speak(speech);

Responses

0 Replies