Skip to content

Instantly share code, notes, and snippets.

@sansmoraxz
Created December 17, 2020 20:27
Show Gist options
  • Save sansmoraxz/f5992f31f01e6734877e41c1f97daa1e to your computer and use it in GitHub Desktop.
Save sansmoraxz/f5992f31f01e6734877e41c1f97daa1e to your computer and use it in GitHub Desktop.
Text to speech browser api
const textToSpeech = "Your speech"
let synUtterance = new SpeechSynthesisUtterance(textToSpeech);
/*
// settimeout unless it changes to use promise
[synUtterance.voice, _] = settimeout(
() => speechSynthesis.getVoices(),
2000);
synUtterance.rate = 1; // default
synUtterance.
*/
window.speechSynthesis.speak(synUtterance);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment