Use speaker connection from Matrix Voice whis Snips

Hi,
I had reported that it still is not possible and what I have tried.
I would have been happy about an answer.
What else is the forum for?

Greetings Klaus

Hello @kmbach,

Apologies for the delay in response.

Yes, the rate ... part has to be right below the pcm "hw.." line, I have corrected that in my first post.

Regarding the audio output for Snips not working through the MATRIX Voice speaker outputs, I found that it is actually more complicated than just forcing the playback to be sampled at 44100 Hz. The audio being played has to be 44100 Hz sampled audio in the first place. That’s why it works for 16000 Hz since that is likely what the Snips playback audio is sampled at.

You received errors with arecord as well since you were recording at 16000 Hz sampling rate while playback was being forced for 44100 Hz sampled audio.

I’m not sure if there’s a straightforward solution to this. My next idea is to try converting the Snips audio to 44100 Hz sampled audio before playback. Again, I haven’t tried it yet. I will give it a go and follow-up within the week.

There are some tools to do this using sox in the command line for recordings. Maybe it is possible with Snips audio as well.

Best,
Samreen

Hello Samreen,

do you already have new insights? I am still interested in a solution.
Thank you very much!

Best, kmbach

Hi @kmbach,

I have not been able to try this yet. I will let you know as soon as I make some progress!

Best,
Samreen

Hello i have same problem and i put a post on snips community

@nicoxygen,

Welcome to the community!

Try the fix here. It is a combination of adding rate 16000 to your pcm.speaker section in /etc/asound.conf and placing portaudio_playback = "default" in /etc/snips.toml file. Your playback hw device will be 2,1, matching your aplay -l output.

Let me know how it goes!

Best,
Samreen

with rate 16000 on asound.conf + hw:2,1 for speaker because card is on 2 + device on 1
+
portaudio_playback = “default” on snips.toml
when i says " hey snips"
i have a brief sound on mic and raspbian crash and I have to manually restart the raspberry

@nicoxygen,

I didn’t realize your speakers are connected to the MATRIX Voice audio jack and not the Raspberry Pi audio jack.

We have not yet figured out how to output Snips audio through the MATRIX Voice audio jack when it is fitted onto the Raspberry Pi. There is an audio streamer project that a community member came out with using an ESP32 MATRIX Voice in which the MATRIX Voice audio jack can output audio but it is programmatically written via SPI to the MATRIX Voice’s amplifier.

This is something that we still need to look into. We know the general cause of the issue. I read that the playback audio for Snips mirrors the audio capture characteristics which by default is 16000 Hz mono for the MATRIX Voice. The way the MATRIX Voice audio is jack is configured at the moment, it can only output audio at 44100 Hz stereo. So, that is where the issue arises.

If you try the fix from the post above, but replace the hw numbers to the Raspberry Pi audio jack and connect the speakers to that, it should work.

Best,
Samreen

with hw:2,1 and speaker connected on left and right, sam test speaker work perfectly but not
after " hey snips"

@nicoxygen,

I think I figured it out. Try the following /etc/asound.conf to get Snips audio output from the MATRIX Voice’s audio jack.

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 "plughw:2,1"
    rate 44100
  }
}

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

No changes required in /etc/snips.toml.

@kmbach,

It’s been a while since you asked me for help with this and I think this is it! Please try as well.

Since you are using the speaker terminals instead of the headphone jack, you should change the default MATRIX Voice output to Speaker. You should be able to do this by typing the following in your terminal first.

amixer -c 2 set Master_Playback_Switch Speaker

Oddly enough, the only difference from what I had suggested long ago was having plughw instead of hw.

Let me know how it goes!

Best,
Samreen

1 Like

thanks it work perfect

1 Like

Unfortunately, this attitude does not lead to success for me.
The raspberry crashes while detecting the hotword.
I have to restart it manually.

Best regards
kmbach

@kmbach,

What is the error log for sam watch from your PC and journalctl -f -u snips-audio-server from the Raspberry Pi when you say the hotword?

Best,
Samreen

:root@raspi_snips:~$ journalctl -f -u snips-audio-server
– Logs begin at Fri 2019-10-18 13:17:01 CEST. –
Okt 18 16:42:30 raspi_snips snips-audio-server[890]: ALSA lib pcm.c:2495:(snd_pc m_open_noupdate) Unknown PCM cards.pcm.surround41
Okt 18 16:42:30 raspi_snips snips-audio-server[890]: ALSA lib pcm.c:2495:(snd_pc m_open_noupdate) Unknown PCM cards.pcm.surround50
Okt 18 16:42:30 raspi_snips snips-audio-server[890]: ALSA lib pcm.c:2495:(snd_pc m_open_noupdate) Unknown PCM cards.pcm.surround51
Okt 18 16:42:30 raspi_snips snips-audio-server[890]: ALSA lib pcm.c:2495:(snd_pc m_open_noupdate) Unknown PCM cards.pcm.surround71
Okt 18 16:42:30 raspi_snips snips-audio-server[890]: ALSA lib pcm.c:2495:(snd_pc m_open_noupdate) Unknown PCM cards.pcm.iec958
Okt 18 16:42:30 raspi_snips snips-audio-server[890]: ALSA lib pcm.c:2495:(snd_pc m_open_noupdate) Unknown PCM cards.pcm.hdmi
Okt 18 16:42:30 raspi_snips snips-audio-server[890]: ALSA lib pcm.c:2495:(snd_pc m_open_noupdate) Unknown PCM cards.pcm.modem
Okt 18 16:42:30 raspi_snips snips-audio-server[890]: ALSA lib pcm.c:2495:(snd_pc m_open_noupdate) Unknown PCM cards.pcm.phoneline
Okt 18 16:42:31 raspi_snips snips-audio-server[890]: INFO:snips_audio_portaudio : Use input device: “MATRIXIO-SOUND: - (hw:2,0)”
Okt 18 16:42:31 raspi_snips snips-audio-server[890]: INFO:snips_broadcast_mqtt_s erver: Starting broadcasting audio on hermes for site “default”

@kmbach,

Does it crash after that? It doesn’t seem to be showing the reason for the crash, but if it’s at that point, it still has to do with audio output.

Have you updated to the latest version of Snips? The update may help. You can do so with the directions here.

Best,
Samreen

I have the system update:

Fehler traten auf beim Bearbeiten von:
/tmp/apt-dpkg-install-DLqCBy/19-matrixio-kernel-modules_0.1.9_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
[mmcblk0p2]:root@raspi_snips:~$

The system is does not boot anymore.

I have to get the system up and running again.

Best kmbach

@kmbach,

You could try from scratch and then implement the /etc/asound.conf above, or you could purge and reinstall the matrixio-kernel-modules package.

Purge with

sudo apt purge matrixio-kernel-modules

Re-install with

sudo apt install matrixio-kernel-modules

Best,
Samreen

I had to redo the entire system now. But with success! Playback
now works through the MATRIX speaker terminals.

Thank you so much!

Best regards

kmbach
1 Like

Hello Samreen have you tested speaker with rhasspy because I can’t get them to work

asound.conf has

pcm.speaker {
type plug
slave {
pcm “plughw:2,1”
rate 44100
}
}

amixer -c 2 set Master_Playback_Switch Speaker

but what an output in setting / sound of rhasspy because each time I select an output and save rhasspy does not take it into account.

@nicoxygen,

I will test this and get back to you this week!

Best,
Samreen