Matrix Voice, Snips & Home Assistant working together


#1

Here a video of the Matrix Voice, Snips & Home Assistant working together.


Install was a clean Rasbian Stretch, the Kernel Modules from Matrix Voice and Snips.
The Snips platform on the pi is brigded to my NAS, where HA is running.
I created a service myself which listens to the hotword toggle topic to control the leds.

#2

@Romkabouter

It’s so beautiful!

BR

– a


#3

Will this work with matrix creator also?


#4

I suspect so, because I have used the kernel modules which look like being the same thing.
Matrix Creator had more sensors.


#5

awesome :+1:
Can your share how you did it. I also testet snips. Installed new strecht on new SD Card. installed Matrix Kernel Modules, installed snips.

I can record with “arecord -f cd test.wav” and play the wav with “aplay test.wav” with the default asound.conf.

But snips does not work. Havethe log entries:

pi@raspberrypi:~ $ sudo tail -f /var/log/syslog
Apr 21 09:34:01 raspberrypi systemd[848]: Reached target Sockets.
Apr 21 09:34:01 raspberrypi systemd[848]: Reached target Paths.
Apr 21 09:34:01 raspberrypi systemd[848]: Reached target Basic System.
Apr 21 09:34:01 raspberrypi systemd[848]: Reached target Default.
Apr 21 09:34:01 raspberrypi systemd[848]: Startup finished in 57ms.
Apr 21 09:34:01 raspberrypi systemd[1]: Started User Manager for UID 1000.
Apr 21 09:34:06 raspberrypi snips-audio-server[834]: ERROR:snips_audio_server   : Error: Source stopped. Bailing out.
Apr 21 09:34:06 raspberrypi systemd[1]: snips-audio-server.service: Main process exited, code=exited, status=1/FAILURE
Apr 21 09:34:06 raspberrypi systemd[1]: snips-audio-server.service: Unit entered failed state.
Apr 21 09:34:06 raspberrypi systemd[1]: snips-audio-server.service: Failed with result 'exit-code'.
Apr 21 09:34:11 raspberrypi systemd[1]: snips-audio-server.service: Service hold-off time over, scheduling restart.
Apr 21 09:34:11 raspberrypi systemd[1]: Stopped Snips Audio Server.
Apr 21 09:34:11 raspberrypi systemd[1]: Started Snips Audio Server.
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: Cannot connect to server socket err = No such file or directory
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: Cannot connect to server request channel
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: jack server is not running or cannot be started
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Apr 21 09:34:11 raspberrypi snips-audio-server[886]: INFO:snips_audio_portaudio: Use input device: "default"
------------

Any hints? Dont know what´s going wrong.
Thanks in advance

Joe


#6

can you post the output of arecord -l?
I believe mine was a clean install as well, but can you also post the contents of to /etc/modules?


#7

Thanks for your answer and your Support.
Hier the lines from aplay -l

pi@raspberrypi:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Dummy [Dummy], device 0: Dummy PCM [Dummy PCM]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 2: SOUND [MATRIXIO SOUND], device 0: matrixio.mic.0 snd-soc-dummy-dai-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0
pi@raspberrypi:~ $

And the content from /etc/modules

pi@raspberrypi:~ ls /etc/modules /etc/modules pi@raspberrypi:~

Seems the Kernel Modules are not loaded?!
But why works the mic?

What can i do the get the modules working?


#8

removed and reinstalled kernel modules but same error in the logs.

Apr 22 07:00:20 raspberrypi systemd[1]: Started Snips Audio Server.
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: Cannot connect to server socket err = No such file or directory
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: Cannot connect to server request channel
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: jack server is not running or cannot be started
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Apr 22 07:00:20 raspberrypi snips-audio-server[800]: INFO:snips_audio_portaudio: Use input device: "default"
Apr 22 07:00:25 raspberrypi snips-audio-server[800]: ERROR:snips_audio_server   : Error: Source stopped. Bailing out.
Apr 22 07:00:25 raspberrypi systemd[1]: snips-audio-server.service: Main process exited, code=exited, status=1/FAILURE
Apr 22 07:00:25 raspberrypi systemd[1]: snips-audio-server.service: Unit entered failed state.
Apr 22 07:00:25 raspberrypi systemd[1]: snips-audio-server.service: Failed with result 'exit-code'.

#9

here the output from lsmod:

    pi@raspberrypi:~ $ lsmod|grep matrix
matrixio_codec         16384  1
matrixio_pcm          278528  1
matrixio_uart          16384  0
snd_soc_core          188416  2 matrixio_pcm,matrixio_codec
matrixio_env           16384  0
matrixio_imu           16384  0
industrialio           73728  2 matrixio_imu,matrixio_env
matrixio_gpio          16384  0
matrixio_everloop      16384  0
matrixio_regmap        61440  0
matrixio_core          16384  4 matrixio_regmap,matrixio_pcm,matrixio_imu,matrixio_env
snd_pcm                98304  5 matrixio_pcm,snd_pcm_dmaengine,snd_bcm2835,snd_soc_core,snd_dummy
pi@raspberrypi:~ $

#10

when i try to save the volume stat i have this error:

pi@raspberrypi:~ $ sudo alsactl store
alsactl: get_control:256: Cannot read control '2,0,0,MIC ARRAY Volume,0': Input/output error

#11

ok. Did a complete new install.
Exactly the same error ins syslog :persevere:


#12

arecord -l looks fine

I think I had the same problem, I will try it again with a clean install.
Created an issue: https://github.com/matrix-io/matrixio-kernel-modules/issues/25

My solution there was: echo “matrixio-everloop” | sudo tee -a /etc/modules
Then reboot

Please past your /etc/asound.conf as well to see if that’s ok


#13

Hi, I had the same problem and I think I solved it. Nothing to do with Matrix. Snips mike setting in /etc/snips.toml needs to be mike = “MATRIXIO SOUND: - (hw:2,0)” for me. Snips-audio-Server tried to use „default“ and this did not work. I have not yet completely tested everything but at least snips-audio-Server is not crashing anymore and I can see entries on the mqtt queue.


#14

Hi, Thanks for your help.
I did booth. the hint from Romkabouter and edit /etc/snips.toml like described from armin.
But snips audio server still not working.

Here the content from asound.conf:

pi@raspberrypi:~ $ cat /etc/asound.conf
pcm.!default {
  type asym
  capture.pcm "mic"
  playback.pcm "speaker"
}

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

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

pcm.array {
  type plug
  slave {
    pcm "hw:2,0"
  }
}```

#15

the content from /etc/snips.toml:

pi@raspberrypi:~ $ cat /etc/snips.toml
[snips-common]
# bus = "mqtt"
# mqtt = "localhost:1883"
# audio = "localhost:26300"
# assistant = "/usr/share/snips/assistant"
# user_dir = "/var/lib/snips"

[snips-analytics]

[snips-asr]
# no_fst_map = true
# beam_size = 8
# model = "/usr/share/snips/asr"
# audio = ["+"]

[snips-asr-google]
# credentials = "/usr/share/snips/googlecredentials.json"
# audio = ["+"]

[snips-audio-server]
# frame = 256
# bind = "0.0.0.0:26300"
# mike = "Built-in Microphone"
mike = "MATRIXIO SOUND:-(hw:2,0)"

[snips-dialogue]
# resources = "/usr/share/snips/dialogue"
# session_timeout = 15
# lambda_timeout = 5
# retry_count = 3

#16

sorry post of plain text dosoent work!?


#17

Good morning,

sorry. I think in my case /etc/snips.toml should have the entry:

mic = “array”

right?


#18

Hmmm.
Testet all possibilities in /etc/snips.toml.
Audioserver still restarts.

Why did it not working?


#19

Hi, I assume you have installed an assistant? I installed the test assistant from the snips install manual. The service will not start without an assistant.
With regard to the audio server. Please stop the audio service and start it manually with a non-existing mike . In the log output, it shows you which mike could be used (consider…).

sudo snips-audio-server --mike test -v


#20

Please also use the exact spelling of the mike. In your snips.toml, it seems that there are spaces missing in the Matrix mike naming. When you start the snips-audio-Server manually, you will directly see once it picked up a valid configuration. After attempt 3, the audio server started. Before it went to attempt 40 and failed.