Last active
October 7, 2016 16:45
-
-
Save danharper/3d6941322bf6d33a1dc716775a7ea46b to your computer and use it in GitHub Desktop.
cycle every SpeechSynthesis voice
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
// would've been awesome if `speechSynthesis.speak` returned a promise which resolves on finish.. :( | |
const sleep = ms => new Promise(r => setTimeout(r, ms)) | |
async function go(msg) { | |
for (let v of speechSynthesis.getVoices()) { | |
speechSynthesis.speak(u = new SpeechSynthesisUtterance(msg), u.voice = v, u) | |
await sleep(1000) | |
} | |
} | |
go('Hello World') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or, transpiled: