[Solved] Matrix Creator and Google Assistant

i had appended matrixio to a previous dtoverlay=… which the matrix software added. fixed that problem.

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Set [C-Media USB Headphone Set], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
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 3: SOUND [MATRIXIO SOUND], device 0: matrixio.mic.0 snd-soc-dummy-dai-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

the device shows up as card 3, and trying both card 2 and card 3 in capture.pcm { … } doesn’t work.

i’m not sure, but can you unplug the usb headphone device and test it again, after another reboot. This may help to narrow down the error.

if it is still showing up as card3, switching the card in pcm.sc { … to 3 could also help.

undid all the stuff I did for changing order and indexes of pcm devices. unplugged usb.

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  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 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
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



$ 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: 1/1
  Subdevice #0: subdevice #0



$ google-assistant-demo --device_model_id XXXX
device_model_id: XXXX
device_id: XXXX

[1038:1060:ERROR:audio_input_processor.cc(748)] Input error
ON_MUTED_CHANGED:
  {'is_muted': False}
ON_START_FINISHED
[1038:1066:ERROR:audio_input_processor.cc(748)] Input error


$ cat .asoundrc
pcm.sc {
    type hw
    card 2
}

pcm.!default
{
  type asym
  playback.pcm {
    type hw
    card 0
    device 0
  }
  capture.pcm {
    type hw
    card 2
    device 0
  }
}

ok i will test this on my device, if i’ll get the same error. But your settings look good now.

Hello @loom and @vizir

Could you remove the /etc/asound.conf . It is the ALSA configuration for HAL support. So if you will work with the kernel modules you don’t need this file.

Regards,

Kevin Patino

removed. same thing.

the “googlesamples-assistant-audiotest” and " googlesamples-assistant-pushtotalk" is working the hotword not, i’ll look into the python code.

googlesamples-assistant-audiotest runs, but i cannot verify if it’s actually recording from the creator mic’s since I don’t have any other audio out except the usb speaker which is unplugged.

but you can run the googlesamples-assistant-pushtotalk it’s outputting text after pressed enter. mine needs permission in some permission in google activity controls, to function.

this is the output

$ googlesamples-assistant-audiotest test
INFO:root:Starting audio test.
INFO:root:Recording samples.
INFO:root:Finished recording.
INFO:root:Playing back samples.
INFO:root:Finished playback.
INFO:root:audio test completed.

hmm not audiotest, the pushtotalk demo.

I just got problems with my SD card, got some kernel crashes. I’ll try again tomorrow, as soon as I have a new one. :slight_smile:

deleted previous reply since I was trying something else.

here’s what push to talk demo says:

$ googlesamples-assistant-pushtotalk --device-model-id trident
INFO:root:Connecting to embeddedassistant.googleapis.com
WARNING:root:Device config not found: [Errno 2] No such file or directory: '/home/pi/.config/googlesamples-assistant/device_config.json'
INFO:root:Registering device
ERROR:root:Option --project-id required when registering a device instance.

looks like I need to register some more info about this device before I can test this.

Can you try this asoundrc file:

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"
  }
}

See it working

If can’t play the video use this link.

Thanks

1 Like

Yeah it works. I also looked at the softvol option yesterday, but the alsa stuff is partly really weird, at least for me.

Thank you very much.

This worked for me as well (using the raspi audio jack) however the sound from Google Assistant is very low and choppy/static. Using aplay to play an mp3 on the other hand sounds loud and clear. I’ve also noticed after following the steps at https://github.com/matrix-io/matrixio-kernel-modules that my raspi is frequently freezing. Any trouble shooting steps or ideas would be appreciated.

I haven’t tested the volume, but I think it can be adjusted with the alsamixer.

I also had several crashes with the pushbutton example. At first I thought it was because of the memory card, but I guess it’s still a bug in the driver. I’ll post a photo of the trace here, unfortunately the message is a bit too short.

Strangely enough, the Alexa example works stable.

But let’s wait until the drivers are officially released. :slight_smile:

with this config, i’m still getting errors:

aplay info

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  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 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
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

arecord:

$ 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: 1/1
  Subdevice #0: subdevice #0

.asoundrc:

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"
  }
}

lsmod | grep matrix

$ lsmod | grep matrix
matrixio_codec          5030  1
matrixio_pcm          267079  1
snd_soc_core          180471  2 matrixio_pcm,matrixio_codec
matrixio_uart           5939  0
matrixio_core           4415  1 matrixio_pcm
snd_pcm                98501  5 matrixio_pcm,snd_pcm_dmaengine,snd_bcm2835,snd_soc_core,snd_dummy

google-assistant-demo:

$ google-assistant-demo --device_model_id trident
device_model_id: trident
device_id: 157C61F22D63BCBFBFE45609C38F5921

[5716:5738:ERROR:audio_input_processor.cc(748)] Input error
ON_MUTED_CHANGED:
  {'is_muted': False}
ON_START_FINISHED
[5716:5744:ERROR:audio_input_processor.cc(748)] Input error

googlesamples-assistant-hotword also:

$ googlesamples-assistant-hotword --device_model_id trident
device_model_id: trident
device_id: 157C61F22D63BCBFBFE45609C38F5921

ON_MUTED_CHANGED:
  {'is_muted': False}
[5760:5782:ERROR:audio_input_processor.cc(748)] Input error
ON_START_FINISHED
[5760:5790:ERROR:audio_input_processor.cc(748)] Input error

alsamixer to adjust audio crashes if i try to select matrixio sound device

 $ alsamixer
cannot load mixer controls: Input/output error

should I just do a fresh install and only do matrixio kmods and then see if it works?

@OrsonAround,

Same happened to me. Fixed it by just asking Google to increase the volume at 100% … using my voice :slight_smile:

The kernel module are incompatible with the latest HAL/MALOS packages, so maybe is related to that. Please remove/stop using MALOS/HAL while using the kernel modules. We are working on a release where this won’t be a problem.

@vizir,

I will suggest to try it again from scratch.
We are working on a guide for this in Hackster that will be out soon :

Will post here!

Thanks for the patience.

I have read the Hackster guide and had a problem. Here is the thread of that conversation so far…
So the assistant works, but the ever loop is just flashing randomly. any help with this would be awesome.
Yoel Castillo
Yoel Castillo
2 days ago
Hi Jared,

Can you share the output of sudo dpkg --list | grep matrix?

Also, we recommend to post this question in the community, this way is easier to follow the topic and others can get help from it too.

Thank you.


Here’s the output:

ii libswresample2:armhf 7:3.2.10-1~deb9u1+rpt1 armhf FFmpeg library for audio resampling, rematrixing etc. - runtime files
ii matrixio-creator-init 0.4.5 armhf Install scripts that can program the MATRIX Creator FPGA and SAM3 IMU.
ii matrixio-openocd 1.0.1 armhf Open on-chip JTAG debug solution for ARM and MIPS systems
ii matrixio-xc3sprog 1.1.1 armhf Spartan3, XCF and CPLD JTAG programmer and other utilities.