Use speaker connection from Matrix Voice whis Snips

Hallo,
how can I use the onboard audio amplifer whis snips?

Many thanks for the help!

Matrix Voice attached to Pi?

Yes, I use Matrix Voice on Pi

Can someone please tell me how to get the voice output from snips to the speaker terminals of the matrix voice board? The Matrix Voice board is on a Raspberry Pi 3 and runs with stretch.
Thank you!

Hi @kmbach,

Setting the MATRIX Voice audio outputs as the default speaker should address this issue. Check out my response to your other post to try this out.

Best,
Samreen

Many thanks for the answer.

With
pcm.speaker {
type plug
slave {
pcm “hw:0,0”
rate 16000
}
}
the sound works on the Raspi. Snips works.

With
pcm.speaker {
type plug
slave {
pcm “hw:0,0”
}
rate 16000
}
the sound does not work on the Raspi.

With
pcm.speaker {
type plug
slave {
pcm “hw:2,1”
rate 44100
}
}
the Raspi crashed when saying hotword in snips.

With
pcm.speaker {
type plug
slave {
pcm “hw:2,1”
}
rate 44100
}
the sound does not work, the Raspi not crashed.

I disable snips und test:
systemctl stop snips-audio-server
amixer set PCM 100% && arecord recording.wav -f S16_LE -r 16000 -d 5
Simple mixer control ‘PCM’,0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback -10239 - 400
Mono: Playback 400 [100%] [4.00dB] [on]
Aufnahme: WAVE ‘recording.wav’ : Signed 16 bit Little Endian, Rate: 16000 Hz, mono
Wiedergabe: WAVE ‘recording.wav’ : Signed 16 bit Little Endian, Rate: 16000 Hz, mono

root@raspi_snips:~$ aplay recording.wav
ALSA lib pcm_plug.c:1263:(_snd_pcm_plug_open) Unknown field rate
aplay: main:788: Fehler beim Öffnen des Gerätes: Das Argument ist ungültig #(Error opening device: The argument is invalid)

Whis
pcm.speaker {
type plug
slave {
pcm “hw:2,1”
}
}
root@raspi_snips:~$ aplay recording.wav
Wiedergabe: WAVE ‘recording.wav’ : Signed 16 bit Little Endian, Rate: 16000 Hz, mono
aplay: set_params:1363: Fehler beim Setzen der Hardware-Parameter:
ACCESS: RW_INTERLEAVED
FORMAT: S16_LE
SUBFORMAT: STD
SAMPLE_BITS: 16
FRAME_BITS: 16
CHANNELS: 1
RATE: 16000
PERIOD_TIME: 125000
PERIOD_SIZE: 2000
PERIOD_BYTES: 4000
PERIODS: 4
BUFFER_TIME: 500000
BUFFER_SIZE: 8000
BUFFER_BYTES: 16000
TICK_TIME: 0

Raspberry Pi 3
Raspbian stretch
Kernel 4.19.42-v7+ #1219
matrixio-kernel-modules Version 0.1.8
Installing Snips Led Control v1.9.8

Many thanks for the support.

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