Last active
March 16, 2020 21:35
-
-
Save kiichi/ac4404cd0f5f85fccecf55dad4584bd9 to your computer and use it in GitHub Desktop.
Text to Speech Using Chrome API (Speech Synthesis)
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
// This takes time... keep the voice reference somewhere before clicking on something | |
let voice_type = speechSynthesis.getVoices().find(function(voice) { return voice.name == 'Samantha'; }); | |
// e.g. after click event | |
var msg = new SpeechSynthesisUtterance(); | |
msg.voice = voice_type; | |
msg.text = "Awesome!"; | |
msg.rate = 1.4; | |
msg.pitch = 3.0; | |
window.speechSynthesis.speak(msg); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment