Created
July 30, 2014 15:42
-
-
Save brazilnut2000/c0fbd5197a2f78d7ea02 to your computer and use it in GitHub Desktop.
JS:Html5SpeechRecognition
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
/* | |
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