Skip to content

Instantly share code, notes, and snippets.

@blacktaxi
Created April 17, 2017 00:24
Show Gist options
  • Save blacktaxi/7d798b6b0f2674cd86d0bb6ee3496fd4 to your computer and use it in GitHub Desktop.
Save blacktaxi/7d798b6b0f2674cd86d0bb6ee3496fd4 to your computer and use it in GitHub Desktop.
webkitSpeechRecognition API usage example
// copy-paste this into a Chrome new tab console and allow mirophone input
// when prompted
var r = new webkitSpeechRecognition()
r.continuous = true
r.interimResults = true
r.onresult = e =>
console.log(
[...e.results].map(
r => r.length > 1
? '[' + [...r].map(a => a.transcript).join('|') + ']'
: r[0].transcript).join(' '))
r.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment