Skip to content

A simple voice command module for MagicMirror² that is highly configurable

Notifications You must be signed in to change notification settings

Veldrovive/MMM-Voice-Commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MMM-Voice-Commands

Demo
Voice Commands is a voice commands module that is designed to be bare bones and allow the user to do whatever they want on their MagicMirror². The voice recognition is built off of annyang so it uses a command based structure. However, it does not use an activation phrase and instead just opts for direct use of statements.

IMPORTANT NOTE - Read before installing:

annyang does not work when Magic Mirror is run using some browsers. In order to ensure that it works, use chrome or firefox if possible. This also means that electron cannot be used since it is a chromium wrapper. The serveronly mode must be used for this module to function.

Installation

Navigate to the modules folder of your Magic Mirror installation.

cd ~/MagicMirror/modules

Clone the repository.

git clone https://github.com/Veldrovive/MMM-Voice-Commands.git

Navigate into the installation and Install Dependencies.

cd MMM-Voice-Commands && npm i

Usage

modules[
    ...
    {
        module: "MMM-Voice-Commands",
        config: {
            debug: false, //Displays end results and errors from annyang in the Log
            autoStart: true, //Adds annyang commands when it first starts
            activateCommand: "hello mirror", //Command to active all other commands
            deactivateCommand: "goodbye mirror", //Command to deactivate all other commands
            alertHeard: false, //Whether an alert should be shown when annyang hears a phrase (mostly for debug)
            commands: {
                "command statement :variable (optional statement)": "SOCKET_NOTIFICATION_NAME",
                //The payload of the socket notification will be whatever is said in the :variable
                "command statement *variable": function(param){
                    alert("Whatever is said in the *variable space is given as the "+param);
                    //These function's 'this' are bound to the module's 'this' so you can do stuff like:
                    this.sendNotification("PAGE_SELECT", "2");
                }
            }
        }
    },
  ...
]
  • If a string is provided as the property in a command, the module will send out a notification with the socket name given by the property and the payload given by the variable in the annyang command.
  • If a function is provided as the property in a command, the module will simply run the function when the command is hear. The argument of the command is given by the variable and this refers to the module's this.

For more information on the command stucure look to the annyang documentation

Usage with external modules

  • Voice Commands communicates with other modules through the notification system.
  • The alert module is automatically utilized if it is present.
  • Voice Commands was developed in conjunction with MMM-Page-Selector. Two use the two together simply use a command in the following format:
    "switch to (the) :page (page)": "PAGE_SELECT" or "go to (page) :number": "PAGE_SELECT"

About

A simple voice command module for MagicMirror² that is highly configurable

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published