[solved] ]Matrix voice Software issues

Hi,

I am continuing the Matrix voice software issues on this new thread from the existing thread

The problems i am currently facing are

  1. I reinstalled the OS and followed the hardware tests mentioned in the previous post . The hal everloop demo worked fine. Hence, i moved on to snowboy implementation. The sample demo.py ran without errors and started listening but no response. I tried both snowboy and Alexa models, shouted out the commands but no response. I went back to check just in case if everloop was working but it just throws error “can’t open any device”.
    The installed packages were: kernel module,hal and malos

  2. I installed malos even though snowboy wasn’t working just to check if i could try a mic example and somehow route the audio to snowboy but on first try , the everloop throwed error “Connected to error publisher with port 20023”. The test driver info script was able to print the output . The port for everloop mentioned is 20021 and the test_everloop_demo contains port as 20013+8. The malos readme file mentions only matrix creator. Is this same for matrix voice as well?

Thank you

@koushikv,

  1. Not sure what python implementation for snowboy you are using. The one we currently maintain is this guide here that includes both Alexa and Snowboy wakeword engines in the installation. Here there has been a very productive discussion related to using that guide. This guide uses the C++ AVS SDK from Amazon, so is not in python.

  2. MALOS is not required for the mics th=o work. The Matrix kernel already installed is all you need. Again, you were trying to use a snowboy code in python that I don’t know how it works.

Yoel

@yoelrc88

Before i can proceed to snowboy. I wanted to clarify the reason for the instability of hal examples. The example executed during installation worked but not now and also the malos example . I just followed the steps for installation fo kernel modules and malos. I didn’t make any other changes except for snowboy . The same on creator works everytime when i test it but not on matrix voice . I think we should first fix this issue and then proceed to snowboy.

Hi @koushikv,

Snowboy’s python demo (demo.py) works in my Matrix Voice. However, I too faced similar issues.

  1. Can you tell me if you have tried to test your Matrix Voice’s microphones with HAL examples (mic_array_direct, mic_energy, etc)?

  2. Can you confirm if the Pyaudio test code(https://github.com/matrix-io/matrixio-kernel-modules/blob/master/misc/pyaudio_test.py) for Matrix Voice is able to record, store and play using your microphones?

It is important to check if the above two tests are working to further debug your issue.

Please, can you share specific errors, outputs or description about HAL examples not working. Thats the only way I can help you. For example:

  • Did all HAL example fail or just some?
  • By “not working” you are referring to the app crashing, not retrieving accurate data or something else?

I agree woth that before going to test snowboy you should have this solved first.

-Yoel

Hi @shashankpr,

  1. No it is not working. see the attached image for the output on execution of hal examples

  2. yes, the python script works.I checked the output.wav file.

Hi @yoelrc88,

please find the screenshot of execution of hal examples in the previous post. This is the latest screenshot of matrix voice.

Can you share the output of this:

sudo dpkg -l | grep matrix

and

sudo lsmod | grep matrix

Thanks

Hi @yoelrc88,

here is the screenshot for the two commands

Good that the output.wav is created and plays.
Now, use the following file (HeyDobby/snowboydecoder_audiorecorder.py at matrix-voice · shashankpr/HeyDobby · GitHub) instead of the default snowboydecoder.py.
Check if the demo.py works now?

P.S: You will have to comment out lines that refer to led (eg. line 13, line 232 etc.)

Hi @shashankpr,

I did as you said. I replaced the reference to snowboydecoder_audiorecorder in both dobby example and rasapberry pi snowboy download as shown below

import snowboydecoder
import snowboydecoder_audiorecorder
import sys
import signal

interrupted = False

def signal_handler(signal, frame):
global interrupted
interrupted = True

def interrupt_callback():
global interrupted
return interrupted

if len(sys.argv) == 1:
print(“Error: need to specify model name”)
print(“Usage: python demo.py your.model”)
sys.exit(-1)

model = sys.argv[1]

capture SIGINT signal, e.g., Ctrl+C

signal.signal(signal.SIGINT, signal_handler)

detector = snowboydecoder_audiorecorder.HotwordDetector(model, sensitivity=0.5)
print(‘Listening… Press Ctrl+C to exit’)

main loop

detector.start(detected_callback=snowboydecoder_audiorecorder.play_audio_file,
interrupt_check=interrupt_callback,
sleep_time=0.03)

detector.terminate()

but i am receiving the below error

Is my changes right?or is there any thing else i am missing?
thanks

Looks like a path problem. Its not able to locate the common.res file.
Try the following example code instead of the previous snowboy decoder one : HeyDobby/mv_decoder_example.py at matrix-voice · shashankpr/HeyDobby · GitHub

1 Like

Hi @shashankpr,

IT WORKS :slight_smile: FINALLY… I checked the mv decoder file and i dont think there is much difference from snowdecoder_recorder is it ? and i think the other major think i missed was the mv_channels and mv_index which i gave as 0 and 2 respectively since my arecord result was like that. Could you let me know how you gave those values?
thanks

Awesome !! :sunglasses:
Glad you got it working! You are right. The only difference is setting no. of channels for matrix voice and its index position (MV_CHANNELS & MV_INDEX, in the code).

Snowboy accepts only 1 channel microphones. Whereas, Matrix Voice consists of 8 channels (since, 8 microphones). Hence, by setting MV_CHANNELS=1, we tell snowboy to use only one microphone.

Regarding MV_INDEX, it usually varies from RPi to RPi. You can get the index position using the arecord -l command. However, a nice way to list all the indices of playback devices as seen by PyAudio is by running this small, helpful code:

import pyaudio
p = pyaudio.PyAudio()
info = p.get_host_api_info_by_index(0)
numdevices = info.get('deviceCount')
for i in range(0, numdevices):
        if (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0:
            print "Input Device id ", i, " - ", p.get_device_info_by_host_api_device_index(0, i).get('name')

Hope this cleared your doubt. Have fun tinkering with your Matrix Voice!

thanks a lot @shashankpr and @yoelrc88 :slight_smile: :+1: