1
0
mirror of https://github.com/onkelbeh/cheatsheets.git synced 2025-06-16 07:07:37 +02:00
cheatsheets/js-speech.md
Rico Sta. Cruz f7c9650a56
Update
2017-08-30 06:28:48 +08:00

507 B

title category layout weight
JavaScript speech synthesis JavaScript 2017/sheet -1

SpeechSynthesisUtterance

{: .-one-column}

function speak (message) {
  var msg = new SpeechSynthesisUtterance(message)
  var voices = window.speechSynthesis.getVoices()
  msg.voice = voices[0]
  window.speechSynthesis.speak(msg)
}
speak('Hello, world')

See: SpeechSynthesisUtterance (developer.mozilla.org)