A tiny javascript SpeechRecognition library that lets your users control your site with voice commands.
annyang has no dependencies, weighs just 2kb, and is free to use and modify under the MIT license.
Play with some live speech recognition demos
It's as easy as adding one javascript file to your document, and defining the commands you want.
<script src="//cdnjs.cloudflare.com/ajax/libs/annyang/1.5.0/annyang.min.js"></script>
<script>
if (annyang) {
// Let's define a command.
var commands = {
'hello': function() { alert('Hello world!'); }
};
// Add our commands to annyang
annyang.addCommands(commands);
// Start listening.
annyang.start();
}
</script>
Check out some live speech recognition demos and advanced samples, then read the full API Docs.
Chrome's implementation of SpeechRecognition behaves differently based on the protocol used:
-
https://
Asks for permission once and remembers the choice. -
http://
Asks for permission repeatedly on every page load. Results are also returned significantly slower in HTTP.
For a great user experience, don't compromise on anything less than HTTPS (an SSL certificate can be as cheap as $5).
Tal Ater: @TalAter
Licensed under MIT.