Skip to content

Instantly share code, notes, and snippets.

@kaplanmaxe
Last active February 19, 2017 14:14
Show Gist options
  • Select an option

  • Save kaplanmaxe/1292b0743c42469ab7189f83f86398f0 to your computer and use it in GitHub Desktop.

Select an option

Save kaplanmaxe/1292b0743c42469ab7189f83f86398f0 to your computer and use it in GitHub Desktop.
JS Speech Recognition
// API: https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API
const recognition = new webkitSpeechRecognition();
recognition.onresult = function(event) {
for (let i = event.resultIndex; i < event.results.length; ++i) {
console.log(event.results[i][0].transcript);
}
}
recognition.start(); // Click allow when browser prompts to use your microphone
recognition.stop(); // Call this when done talking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment