Skip to content
A simple Javascript framework for adding voice commands to a web site using the web speech recognition API.
Branch: master
Clone or download
Pull request Compare This branch is 9 commits ahead, 417 commits behind TalAter:master.
Johan Johansson
Latest commit 36992ed Oct 14, 2014
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
build
docs Bumped version number to 1.0.1 and built Oct 14, 2014
src Wrap simple string commands in ^ and $ Oct 14, 2014
.gitignore Initial commit of mumble 1.0.0 Oct 14, 2014
CHANGELOG.md Bumped version number to 1.0.1 and built Oct 14, 2014
LICENSE Initial commit of mumble 1.0.0 Oct 14, 2014
README.md Updated examples in readme Oct 14, 2014
gulpfile.js Initial commit of mumble 1.0.0 Oct 14, 2014
package.json Bumped version number to 1.0.1 and built Oct 14, 2014

README.md

#mumble.js A simple Javascript framework for adding voice commands to a web site using the web speech recognition API. Supports RegEx command syntax and the CommonJS/AMD module syntax.

Forked from and inspired by https://github.com/TalAter/annyang.

##Demo For a demo of the original library (annyang.js), see https://www.talater.com/annyang. The end-user experience is basically the same.

##Usage

  • If using node.js with browserify for example you can run npm install mumble-js within your app to get the latest version. Then require('mumble-js').
  • If you're using a plain web app include mumble.js or mumble.min.js directly on your site.

Then define some commands and start the device:

// if using node.js, else leave out
var Mumble = require('mumble-js');

// for all options, see the docs
var mumble = new Mumble({
    language: 'en-US',
    debug: false, // set to true to get some detailed information about what's going on

    // define some commands using regex or a simple string for exact matching
    commands: [{
        name: 'appointment',
        command: /^book (.+) for me (today|tomorrow) at (\d+)$/,

        action: function(type, date, hour) {
            console.log('Making an appointment for %s %s at %d', type, date, hour);
        }
    }, {
        name: 'google',
        command: /^google (.+) for me\s?(please)?$/,

        action: function(query, polite) {
            if (polite) {
                // google the query
            } else {
                console.log('I will google that for you but only if you say please');
            }
        }
    }],

    // define global callbacks (see docs for all)
    callbacks: {
        start: function(event) {
            console.log('Starting..');
        }

        // start, end, speech, recognizeMatch, etc
    }
});

// add a command afterwards, or anytime
mumble.addCommand('clock', 'what is the time', function() {
    console.log(new Date());
});

// start listening
mumble.start();

##Microphone permissions and HTTP(S) 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).

While developing, you can use a self-signed SSL certificate described here: https://www.sslshopper.com/article-how-to-create-and-install-an-apache-self-signed-certificate.html.

##API Documentation Check out mumble.md in the docs/ folder for the public API methods and all available options.

##Authors

##License Licensed under MIT.

You can’t perform that action at this time.