Cant get snips and matrix to work after following tutorial

I found the answer:

Snips is crashing when if plays the feedback audio file. Since the Matrix Voice is providing that feedback through Neopixels it can be disabled and everything works fine. There is however an issue to be resolved with the discrepency in the frequency of the audio output.

Change the line in /etc/snips.toml:

[snips-dialogue]
sound_feedback_disabled_default = false
to:
sound_feedback_disabled_default =true

make sure to uncomment the line

1 Like

Hi @rickmini,

You are correct, it is an issue with audio output frequency. Another solution we found to work is adding the following line (rate 16000) in /etc/asound.conf. This enables the audio output to play as it should so it doesn’t block Snips.

playback.pcm {
   type plug
   slave.pcm “hw:0,0”
   rate 16000
}

Best,
Samreen

1 Like

was having the same issue thought before the coffee pot was finished brewing I would have a look and see if it was common glad I found it so quickly on here will give it a go once the coffee is in my hand.

1 Like

Thanks,
Ill give it a try

Hi,

I setup Matrix voice.
When I test the tutorial with sam watch I get the following error:

[07:28:23] [Nlu] detected intent searchWeatherForecast with confidence score 0.980 for input "will it is the weather"

[07:28:23] [Dialogue] New intent detected searchWeatherForecast with confidence 0.980
[07:28:23] [Dialogue] was ask to end session with id 4b0252e6-2371-4ee6-a5b5-a8b523d9da34 by saying 'You asked for the weather ’
[07:28:23] [Tts] was asked to say “You asked for the weather”
[07:28:23] [Audio Server] reported an error on site default : An error happened while trying to play some audio
[07:28:23] [Audio Server] reported an error on site default : Could not process chunk 1 of steam “d7b122e5-c594-4bb2-abf2-3822d44480e9”
[07:28:23] [Audio Server] reported an error on site default : Could not process chunk 2 of steam “d7b122e5-c594-4bb2-abf2-3822d44480e9”
[07:28:23] [Audio Server] reported an error on site default : Could not process chunk 3 of steam “d7b122e5-c594-4bb2-abf2-3822d44480e9”
[07:28:23] [Audio Server] reported an error on site default : Could not process chunk 4 of steam “d7b122e5-c594-4bb2-abf2-3822d44480e9”
[07:28:23] [Audio Server] reported an error on site default : Could not process chunk 5 of steam “d7b122e5-c594-4bb2-abf2-3822d44480e9”
[07:28:23] [Audio Server] reported an error on site default : Could not process chunk 6 of steam “d7b122e5-c594-4bb2-abf2-3822d44480e9”
[07:28:23] [Audio Server] reported an error on site default : Could not process chunk 7 of steam “d7b122e5-c594-4bb2-abf2-3822d44480e9”
[07:28:23] [Audio Server] reported an error on site default : Could not process chunk 8 of steam “d7b122e5-c594-4bb2-abf2-3822d44480e9”
[07:28:23] [Audio Server] reported an error on site default : Could not process chunk 9 of steam “d7b122e5-c594-4bb2-abf2-3822d44480e9”
[07:28:23] [Audio Server] reported an error on site default : Could not process chunk 10 of steam “d7b122e5-c594-4bb2-abf2-3822d44480e9”
[07:28:38] [Dialogue] session with id ‘4b0252e6-2371-4ee6-a5b5-a8b523d9da34’ was ended on site default. The session timed out because the TTS component did not respond in a timely manner. Please ensure that the tts is started and running correctly.
[07:28:38] [Asr] was asked to stop listening on site default

Hey @dimiterk,

Welcome to the community!

Have you tried the suggestion of placing rate 16000 in the /etc/asound.conf file that was mentioned before already?

Let me know and we can go from there!

Best,
Samreen

Hey Samreen,

Thanks for the suggestion.

I did add that. Also when you restart the RPI it gets overwritten.
Even when you change it during the session I still get the same issue:

[20:27:28] [Dialogue] was ask to end session with id 3ae36c6b-6f2b-467b-b9cd-8f4425d05e92 by saying 'You asked for the weather  today'
[20:27:28] [Tts] was asked to say "You asked for the weather  today"
[20:27:29] [Audio Server] reported an error on site default : An error happened while trying to play some audio
[20:27:29] [Audio Server] reported an error on site default : Could not process chunk 2 of steam "9f598b40-c9af-4026-805f-d93d0c8cbdb9"
[20:27:29] [Audio Server] reported an error on site default : Could not process chunk 3 of steam "9f598b40-c9af-4026-805f-d93d0c8cbdb9"
[20:27:29] [Audio Server] reported an error on site default : Could not process chunk 4 of steam "9f598b40-c9af-4026-805f-d93d0c8cbdb9"
[20:27:29] [Audio Server] reported an error on site default : Could not process chunk 5 of steam "9f598b40-c9af-4026-805f-d93d0c8cbdb9"
[20:27:29] [Audio Server] reported an error on site default : Could not process chunk 6 of steam "9f598b40-c9af-4026-805f-d93d0c8cbdb9"
[20:27:29] [Audio Server] reported an error on site default : Could not process chunk 7 of steam "9f598b40-c9af-4026-805f-d93d0c8cbdb9"
[20:27:29] [Audio Server] reported an error on site default : Could not process chunk 8 of steam "9f598b40-c9af-4026-805f-d93d0c8cbdb9"
[20:27:29] [Audio Server] reported an error on site default : Could not process chunk 9 of steam "9f598b40-c9af-4026-805f-d93d0c8cbdb9"
[20:27:29] [Audio Server] reported an error on site default : Could not process chunk 10 of steam "9f598b40-c9af-4026-805f-d93d0c8cbdb9"
[20:27:29] [Audio Server] reported an error on site default : Could not process chunk 11 of steam "9f598b40-c9af-4026-805f-d93d0c8cbdb9"
[20:27:29] [Audio Server] reported an error on site default : Could not process chunk 12 of steam "9f598b40-c9af-4026-805f-d93d0c8cbdb9"
[20:27:29] [Audio Server] reported an error on site default : Could not process chunk 13 of steam "9f598b40-c9af-4026-805f-d93d0c8cbdb9"
[20:27:29] [Audio Server] reported an error on site default : Could not process chunk 14 of steam "9f598b40-c9af-4026-805f-d93d0c8cbdb9"
[20:27:44] [Dialogue] session with id '3ae36c6b-6f2b-467b-b9cd-8f4425d05e92' was ended on site default. The session timed out because the TTS component did not respond in a timely manner. Please ensure that the tts is started and running correctly.
[20:27:44] [Asr] was asked to stop listening on site default

Samreen,
I tried that as well but it made no difference. Could you please post the entire asound.conf file. Mine looks different from yours.
Thanks

Hi @rickmini and @dimiterk,

My asound.conf file looks like this and I added rate 16000 in the pcm.speaker section.

I will install Snips on a Pi 3 with Raspbian Stretch again to see if I can replicate your issues, troubleshoot from there, and get back to you in some time.

Best,
Samreen

Here is my asound.conf:

pcm.!default {
type asym
capture.pcm “mic”
playback.pcm “speaker”
}

pcm.mic {
type softvol
slave {
pcm “array”
}
control {
name “MicArray Master”
card “MATRIXIOSOUND”
}
}

pcm.speaker {
type plug
slave {
pcm “hw:0,0”
rate 16000
}
}

pcm.array {
type plug
slave {
pcm “hw:MATRIXIOSOUND”
}
}

When i do this i get unrecognizeable static out of the speaker. The snips watch shows that i crashes the audio server trying to play a sound.

i have then tried updating to the new snips version just released. No difference.
alsamixer looks good
and i can sam test microphone and sam test speaker with good results
the only way to keep it from crashing is to disable sound playback in snips.toml

Its hard to believe that no one can get this to work properly. I have watched your videos, but most of them seem to use a simple .js script to do things with matrix lite.

I have too much code to integrate to use javascript, so i prefer to use your lite_py
but that is in python3, and i cant get it to work properly with snips (python2). If any of your engineers have gotten matrix lite python to work with snips, please send me a link to the project.

Thanks

@rickmini,

I think I found the workaround!

Your /etc/asound.conf file looks good. Disclaimer for people following the thread, don’t copy paste the config in Rick’s post above as the formatting of the quotation marks renders it a special character that asound.conf cannot parse!

The workaround is as follows. Be sure to enable playback again before testing if you had disabled it before.

/etc/asound.conf file as below.

pcm.!default {
  type asym
  capture.pcm "mic"
  playback.pcm "speaker"
}

pcm.mic {
   type softvol
   slave {
     pcm "array"
   }
   control {
     name "MicArray Master"
        card "MATRIXIOSOUND"
   }
}

pcm.speaker {
  type plug
  slave {
    pcm "hw:0,0"
    rate 16000
  }
}

pcm.array {
  type plug
  slave {
    pcm "hw:MATRIXIOSOUND"
  }
}

Then, add the following to /etc/snips.toml to the section with [snips-audio-server]

portaudio_playback = "default"

image

Then check sam watch. It should be working! I’ve been testing for 30 minutes or so. Please let me know if anybody finds it breaks after a while.

If anyone’s interested, I found a version of the workaround in the Snips issue here. From the Snips software changelogs, it seems they recently updated Snips to playback audio using ALSA instead of portaudio as portaudio used to cause rate issues (the reason for us having the rate 16000 workaround), but now ALSA seems to be having some issues of its own :sweat_smile:

So, this solution just uses portaudio again like before with the same rate 16000 workaround. The rate is 16000 Hz for MATRIX boards as that is the default capture sampling rate for our mics and the playback reflects that.

@dimiterk, I would recommend trying this as well.

Let me know how it goes!

Best,
Samreen

@rickmini,

Regarding python, we haven’t tried that yet but I’ll let you know if we do!

As far as I know, Snips has ported its skills to Python 3 as well so you shouldn’t have version incompatibilities. Here is their weather demo code which may help you visualize the communication with the Snips hermes server through MQTT.

Best,
Samreen

Samreen,
It didnt work, it still crashes:
I never hear the recognition “ding sound”, because it crashed the ASR.
Are you actually hearing this sound, and can you get it to speak back to you? I cant do either. But all of this does work on another pi imaged the same, but setup with the Snips default audio (respeaker2 hat).
here is the sam watch:

[21:46:22] Watching on localhost:1883 (MQTT)
[21:46:24] [Hotword] detected on site default, for model hey_snips
[21:46:24] [Asr] was asked to stop listening on site default
[21:46:24] [Hotword] was asked to toggle itself ‘off’ on site default
[21:46:24] [Dialogue] session with id ‘267ac596-45d9-4edf-a8e5-de7e050ea68c’ was started on site default
[21:46:24] [AudioServer] was asked to play a wav of 41.1 kB with id ‘cbf5b1d9-5812-474c-b9b6-318284725bac’ on site default
[21:46:34] [Audio Server] reported an error on site default : An error happened while trying to play some audio
[21:46:39] [Dialogue] session with id ‘267ac596-45d9-4edf-a8e5-de7e050ea68c’ was ended on site default. The session timed out because the Audio Server component did not respond in a timely manner. Please ensure that the snips audio server is started and running correctly.
[21:46:39] [Asr] was asked to stop listening on site default
[21:46:39] [Hotword] was asked to toggle itself ‘on’ on site default

Attached is my snips.toml in case there is something that is different from yours:

toml2

@rickmini,

The line in /etc/snips.toml is

portaudio_playback = "default"

Seems you have a dash (-) instead of an underscore (_).

Best,
Samreen

Samreen,
You are my hero!
That one character mistake of mine meant the difference between no audio and the ASR crashing to everything working like a charm. With excellent audio! The matrix runs circles around the respeaker2. Now if i can just get the matrix neopixels to animate a la google, from within my python3 code with hermes running that would be great, if you can suggest any links to that end it would be helpful.

Again, thanks so much for your help. Also i would suggest you provide a Raspi stretch image (buster would be better, but i have only heard failures with Snips integration) with a basic weather snips assistant that people could use to get up and running in an hour instead of weeks. Then they can easily replace it with an assistant of their own.

Hey Samreen,

Thanks, that almost works for me.

Adding portaudio_playback = “default” fixes the issue I reported above however I still get no sound from the speakers. I issue sam setup auido and select MatrixSound

I observe that every time I restart the line “rate 16000” gets removed from the /etc/asound.conf.

At the moment every time I issue a Hey snips command the RPI experiences a kernel crash:

kernel:[  434.358074] dee0: 152c7c85 9adbdef0 808366a4 80201e84 b3068e00 7f0d2868 9adbdf1c 485a21e0

Message from syslogd@RPI at Oct 18 20:28:35 ...
 kernel:[  434.358091] df00: 7f0d2868 b3068e00 b69e2400 60000013 7f200344 7f208358 80d04d48 9adb3bc4

Message from syslogd@RPI at Oct 18 20:28:35 ...
 kernel:[  434.358110] df20: 9adbdf4c 9adbdf30 7f0d94fc 7f0d9094 b48b0400 7f200340 80adc768 7f20836c

Message from syslogd@RPI at Oct 18 20:28:35 ...
 kernel:[  434.358128] df40: 9adbdf7c 9adbdf50 7f1fe4ec 7f0d9484 00000000 485a21e0 a1d4ec80 a1d4e840

Message from syslogd@RPI at Oct 18 20:28:35 ...
 kernel:[  434.358145] df60: 00000000 b48b0400 7f1fe3b8 a1d4ec9c 9adbdfac 9adbdf80 8014253c 7f1fe3c4

Message from syslogd@RPI at Oct 18 20:28:35 ...
 kernel:[  434.358162] df80: 80104378 a1d4e840 80142404 00000000 00000000 00000000 00000000 00000000

Message from syslogd@RPI at Oct 18 20:28:35 ...
 kernel:[  434.358179] dfa0: 00000000 9adbdfb0 801010ac 80142410 00000000 00000000 00000000 00000000

Message from syslogd@RPI at Oct 18 20:28:35 ...
 kernel:[  434.358196] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

Message from syslogd@RPI at Oct 18 20:28:35 ...
 kernel:[  434.358212] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000

Message from syslogd@RPI at Oct 18 20:28:35 ...
 kernel:[  434.359003] Code: e92d4100 e1a08001 e1a0e003 e2522040 (a8ac410a)

when i restart the line “rate 16000” does not get removed from the /etc/asound.conf. Does he have anything in the ~/.asoundrc that will override settings for that pi user

I don’t have this file so I don’t understand how this gets overwritten at the moment.

it has a dot in front so here is full path:
ls ~/.asoundrc

sometimes i have found this due to a setup of a program outside of snips. It will override asound.conf for user pi

there may be another program installed on your machine that is copying over /etc/asound.conf check the docs of any other sound based program that you use or a .service file that could do this

I checked , I still don’t have that file.
I get the following

cannot access '/home/pi/.asoundrc': No such file or directory

I’ll probably start from scratch at this point again.