Skip to content

Instantly share code, notes, and snippets.

@brazilnut2000
Created July 30, 2014 15:42
Show Gist options
  • Save brazilnut2000/c0fbd5197a2f78d7ea02 to your computer and use it in GitHub Desktop.
Save brazilnut2000/c0fbd5197a2f78d7ea02 to your computer and use it in GitHub Desktop.
JS:Html5SpeechRecognition
/*
This is really interesting, I had no idea.
http://shapeshed.com/html5-speech-recognition-api/
HTML5 includes built in speech recognition, which is stupid easy to use:
Open your console and enter:
*/
var recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.interimResults = true;
recognition.onresult = function(event) {
console.log(event)
}
recognition.start();
/*
You’ll be asked for access to your mic, allow that and then say something. The console will log a packet that looks like this:
{
..
results: {
0: {
0: {
confidence: 0.695017397403717,
transcript: "look Mum I'm talking into a web page!"
},
isFinal:true,
length:1
},
length:1
},
..
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment