Skip to content

Instantly share code, notes, and snippets.

@tancnle
Last active August 29, 2015 14:24
Show Gist options
  • Save tancnle/ff80052fc4700ab63568 to your computer and use it in GitHub Desktop.
Save tancnle/ff80052fc4700ab63568 to your computer and use it in GitHub Desktop.
Make your browser speak
var say = function(msg) {
var speech = new SpeechSynthesisUtterance();
var voices = window.speechSynthesis.getVoices();
speech.voice = voices[10]; // 'en-AU' 'Karen'
speech.text = msg;
speech.onend = function(e) {
console.log('Finished in ' + event.elapsedTime + ' seconds.');
};
speechSynthesis.speak(speech);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment