@shashank
For sure. Forgive me if there are several steps.
First thing is to install this module
https://github.com/alexyak/voicecontrol
Go to your MagicMirror/modules folder and type
git clone https://github.com/alexyak/voicecontrol.git
Then install dependencies with
sudo apt-get install python-pyaudio python3-pyaudio sox
Next, install the navbar. Again, make sure you are in the MagicMirror/modules folder and type
git clone https://github.com/chr1syy/MM-navbar.git
Then you will need to go to this website and define your voice commands.
https://snowboy.kitt.ai/
Keep track of the keywords you define and the filenames you produce. Each keyword/command will require you to download a .pmdl file that needs to be copied into the MagicMirror folder on your Pi. I’m only using 3 commands so far - calendar, newsfeed, and weather.
Still with me? Sweet! Lets configure config.js. Go to the MagicMirror/config folder and
nano config.js
Assuming you know where to place a new module in this file, add the navbar module with
{
module: 'MM-navbar',
position: 'fullscreen_above'
},
Next we will add the voice control call to the same config.js file. There are a couple variables here that will depend on the keywords and filenames you used on the snowboy site. Here is the code I use
{
module: 'voicecontrol',
position: 'bottom_right',
config: {
models: [
{
keyword: "Calendar",
description: "Say 'Calendar' to toggle display",
file: "calendar.pmdl",
message: "CALENDAR"
},
{
keyword: "Newsfeed",
description: "Say 'Newsfeed' to toggle display",
file: "newsfeed.pmdl",
message: "NEWSFEED"
},
{
keyword: "Weather",
description: "Say 'Weather' to toggle display",
file: "weather.pmdl",
message: "WEATHER"
}
]
}
},
Note that the keyword and file need to match the keyword and filenames you used on your Snowboy files. Save and quit out of config.js and we’ll hit the last step. We need to make a couple changes to the navbar code. Navigate to MagicMirror/modules/MM-navbar then
nano MM-navbar.js
First change is at line 13. Right now lines 12-19 look like this
notificationReceived: function(notification, payload, sender){
if (notification === 'DOM_OBJECTS_CREATED'){
MM.getModules().exceptModule(this).exceptWithClass('clock').enumerate(function(module){
module.hide(1000, function(){
});
});
}
},
You will need to modify it to look like this
notificationReceived: function(notification, payload, sender){
if (notification === "CALENDAR"){
var calendarbutton = document.getElementById('calendar-button');
calendarbutton.click();
}
if (notification === "NEWSFEED"){
var newsbutton = document.getElementById('news-button');
newsbutton.click();
}
if (notification === "WEATHER"){
var weatherbutton = document.getElementById('weather-button');
weatherbutton.click();
}
},
Now we’re going down to the section that originally starts on line 32
wrapper.className = "center";
weatherbutton.className = "wi wi-day-rain-mix navbar";
calendarbutton.className = "fa fa-calendar navbar";
newsbutton.className = "fa fa-newspaper-o navbar";
And change it to
wrapper.className = "center";
weatherbutton.className = "wi wi-day-rain-mix navbar";
weatherbutton.id = 'weather-button';
calendarbutton.className = "fa fa-calendar navbar";
calendarbutton.id = 'calendar-button';
newsbutton.className = "fa fa-newspaper-o navbar";
newsbutton.id = 'news-button';
Save, close and restart your MM and you should have a working, voice responsive nav bar. I know there are kind of a lot of steps here and typos and omissions are entirely possible. If you have any problems let me know and I’ll try to help. Cheers!