Skip to content

Instantly share code, notes, and snippets.

@fitsum
Last active December 31, 2021 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitsum/044198807412ca88ce7fe1a5d7d6d25c to your computer and use it in GitHub Desktop.
Save fitsum/044198807412ca88ce7fe1a5d7d6d25c to your computer and use it in GitHub Desktop.
speaks english voices in given browsers
speakEnglish = () => { voices = speechSynthesis.getVoices(); voices.filter(voice => voice.lang === "en-US" ).forEach(voice => {
const utterance = new SpeechSynthesisUtterance("What's poppin, bitches?")
utterance.voice = voice;
// default volume !== 1
utterance.volume = 1;
speechSynthesis.speak(utterance);
// next line causes function not to fire on first invocation 🤷🏾‍♂️
utterance.addEventListener('start',()=>{console.log('voice name:', voice.name)})
}) }
speakEnglish()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment