Created
December 17, 2020 20:27
-
-
Save sansmoraxz/f5992f31f01e6734877e41c1f97daa1e to your computer and use it in GitHub Desktop.
Text to speech browser api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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