Last active
December 5, 2019 19:47
-
-
Save Orbis25/c996c5ea2e19021a6d79a16481621758 to your computer and use it in GitHub Desktop.
Text to spech example usin api from javaScript (speaknowjs)
This file contains 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 synth = window.speechSynthesis; | |
const readText = ( | |
text = "FELICIDADES" | |
) => { | |
voices = synth.getVoices(); | |
event.preventDefault(); | |
let utterThis = new SpeechSynthesisUtterance(text); | |
var selectedOption = "Google español de Estados Unidos"; | |
for (i = 0; i < voices.length; i++) { | |
if (voices[i].name === selectedOption) { | |
utterThis.voice = voices[i]; | |
} | |
} | |
synth.speak(utterThis); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment