Lights not change from the official demo of Matrix-malos-wakeword

Hi

I just received Matrix Voice, it works quite well, I have two questions:

1.Matrix - Pocketsphinx -
the DEMO works charm, and the light does change from what I command.
Is it possible to create a command from Sphinx Knowledge Base Tool and make this command to play an audio file I put in the asset? (meaning - when user say this voice command, the voice file will play from Matrix + Pi)

2.Matrix MALOS-Wakeword
it works quite well, but when I run the demo of “node test_wakeword.js” it did show “WakeWord Reached: voice recognition ready” on my terminal, and it did show “WakeWord Reached: MIA RING RED” when I say MIA RING RED, but didn’t make any change on lights or anything or show any errors, do I need to make any change to make the lights works?

Your answer will be truly appreciated!

Thanks.

Hi @zepets. The Pocket Sphinx demo can be edited to use other commands if you choose to do so. You could then tie those commands to call upon a separate script that plays an audio file.

In regard to your second question, the wake word demo was originally made for the MATRIX Creator and has the number of LEDs set to 35 which is higher than what the MATRIX Voice has. If you edit the number 35 to 18, in this line, the demo should now be able to change the LEDs on your MATRIX Voice.

Let us know if you have any more questions.

1 Like

For nodejs code, I wrote a function called playSound that I simply pass a string representing the path and name of the file:

function playSound(the_sound_path) {
const execSync = require(‘child_process’).execSync;
code = execSync("sudo play " + the_sound_path);
}

playSound(’/home/pi/alexa/sounds/welcome.wav &’);

-Sean

1 Like

Carlos,

Thanks a lot for the quick reply, I am pretty new to this kind of thing, would you mind elaborate more about it? I understand how to create new command from the knowledge base tool, but no idea how to use that command to call upon a separate command (audio play JavaScript maybe) to play it, if you could show me a simple example will be really appreciated, thanks again!

Thanks a lot for the reply!!

how should I do this, put your code in a separate JS file then run it or in the same official demo JS file?

Thanks.

Sure! I can show you a javascript example. Here is a GitHub gist to an example app that plays an audio file when it hears “MIA PLAY SOUND”. You’ll need to make provide the audio file and Pocket Spinx files, but let us know if you have any questions on how to set it up.

Also, I recommend looking into Understanding MATRIX CORE for a better visualization on how ZMQ ports work.

Hi @zepets. Following up, we wanted to notify you that the documentation for MATRIX CORE Wakeword was officially added. Here is a link to the Javascript example and Python example. Let us know if you have any questions or suggestions.

Hi Carlos,

Thanks a lot for the update, I followed your instruction create a js file and update all the file name (audio and Pocket Spinx files ) to my file name, but got error message when execute the js file as below, would you mind let me know how should I fix it? thanks!

Error: Cannot find module ‘zeromq’
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object. (/home/pi/matrix-malos-wakeword/src/js_test/audio_test.js:5:11)
at Module._compile (module.js:556:32)
at Object.Module._extensions…js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)

for solving this issue I tried two ways to install zeromq and zmq -

1.$npm install zmq
2.follow guide of installing zeromq on core installing page
echo “deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/ ./” >> /etc/apt/sources.list
wget https://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/Release.key -O- | sudo apt-key add

“echo “deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/ ./” >> /etc/apt/sources.list” is always permission denied in last 1 week

“wget https://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/Release.key -O- | sudo apt-key add” works fine

Have taken a look at the JavaScript setup page? This will walk you through creating a folder for your javascript files. Let us know if you’re still experiencing the same result. It might be a good idea to re-flash a new image and follow the MATRIX CORE installation page again.

Nothing change after this edit, Matrix Voice can recognise my voice and shows MIA RED MIA BLUE on the terminal, but no LED lights or any light changes, thanks.

Thanks, it’s working now :smile:
but when Matrix Voice play my mp3 file, the sound is all noise rather than the audio, do I need a driver or anything to make mp3 play normally? thanks.

Have you tried to play a wav file?

for example :

wget http://www.music.helsinki.fi/tmt/opetus/uusmedia/esim/a2002011001-e02.wav
aplay ./a2002011001-e02.wav