Matrix Creator ALSA & Mic Issues

Hi,
As you all know Raspberry OS had a recent update that added the option to choose audio output.

I have run:
arecord recording.wav -f S16_LE -r 16000 -d 5
then
play recording.wav
It was not working so I went to sudo raspi-config > Advanced Option > Audio and changed from HDMI to Headphones (3.5mm jack) because that’s where my speaker is connected.
Then I was able to play sound, However when I wanted to check this again and record this was the error I was getting after running record:

ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM input
arecord: main:828: audio open error: No such file or directory

I have set: /etc/asound.conf rate to 16000…
No success…

Any ideas on how this can be fixed?
I think this is the reason why the Pcketsphinx and Audio in Rhasspy is not working. Any idea how to fix this?

Hey,

I’m sorry to say that I am also having issues recording audio. Hopefully we have the same issue and a common solution can be found. Lets see if the outputs of the following commands match up between us two:

➜  ~ 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 "MATRIXIOSOUND"
   }
}

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

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

pcm.channel_1 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }
    bindings.0  0
}

pcm.channel_2 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }    
    bindings.0  1
} 

pcm.channel_3 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }    
    bindings.0  2
} 

pcm.channel_4 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }    
    bindings.0  3
} 

pcm.channel_5 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }    
    bindings.0  4
} 

pcm.channel_6 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }    
    bindings.0  5
} 

pcm.channel_7 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }    
    bindings.0  6
} 

pcm.channel_8 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }    
    bindings.0  7
} 

pcm.all_channels {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }    
    bindings {
            0 0
            0 1
            0 2
            0 3
            0 4
            0 5
            0 6
            0 7
    }
} 

➜  ~ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Dummy [Dummy], device 0: Dummy PCM [Dummy PCM]
  Subdevices: 7/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: MATRIXIOSOUND [MATRIXIO-SOUND], device 0: matrixio.mic.0 snd-soc-dummy-dai-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0

➜  ~ ls /boot/overlays | grep matrix  
matrixio.dtbo

➜  ~ sudo lsmod | grep matrix
matrixio_uart          16384  0
matrixio_codec         16384  4
matrixio_playback      49152  1
matrixio_mic           16384  1
snd_soc_core          192512  4 matrixio_playback,vc4,matrixio_codec,matrixio_mic
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  1
matrixio_core          16384  7 matrixio_everloop,matrixio_regmap,matrixio_playback,matrixio_imu,matrixio_mic,matrixio_uart,matrixio_env
snd_pcm               102400  11 matrixio_playback,vc4,snd_pcm_dmaengine,matrixio_mic,snd_bcm2835,snd_soc_core,snd_dummy
snd                    73728  25 snd_compress,matrixio_playback,snd_timer,snd_bcm2835,snd_soc_core,snd_dummy,snd_pcm

➜  ~ sudo dpkg -l | grep matrix

ii  libmatrixio-creator-hal:armhf     0.3.8                               armhf        Hardware Abstraction Layer for MATRIX.
ii  libmatrixio-creator-hal-dev       0.3.8                               armhf        Hardware Abstraction Layer for MATRIX (headers)
ii  libmatrixio-malos:armhf           0.1.4                               armhf        Libraries of MATRIX abstraction layer for MOS
ii  libmatrixio-malos-dev             0.1.4                               armhf        Libraries of MATRIX abstraction layer for MOS
ii  libmatrixio-protos:armhf          0.1.6                               armhf        Protocolbuffers for MATRIX abstraction layer
ii  libmatrixio-protos-dev            0.1.6                               armhf        Protocolbuffers headers for MATRIX abstraction layer
ii  libswresample3:armhf              7:4.1.4-1+rpt7~deb10u1              armhf        FFmpeg library for audio resampling, rematrixing etc. - runtime files
ii  matrixio-creator-init             0.4.17                              armhf        Install scripts that can program the MATRIX Creator FPGA and SAM3 IMU.
ii  matrixio-kernel-modules           0.2.3                               all          Source DKMS for MATRIXIO kernel modules.
ii  matrixio-libzwaveip:armhf         0.1.2                               armhf        libzwaveip is a library to control Z-Wave devices from your IP network via a Z/IP Gateway
ii  matrixio-libzwaveip-dev           0.1.2                               armhf        libzwaveip is a library to control Z-Wave devices from your IP network via a Z/IP Gateway
ii  matrixio-malos                    0.3.6                               armhf        Allows queries to MATRIX Creator hardware via ZMQ.
ii  matrixio-malos-zigbee             0.1.7                               armhf        Allows queries to MATRIX Creator hardware via ZMQ.
ii  matrixio-malos-zwave              0.1.6                               armhf        Allows queries to MATRIX Creator hardware via ZMQ.
ii  matrixio-openocd                  1.0.1.002                           armhf        Open on-chip JTAG debug solution for ARM and MIPS systems
ii  matrixio-protobuf                 3.8.0                               armhf        Protocol Buffers - Google's data interchange format. (From GRPC 3.8.0)
ii  matrixio-xc3sprog                 1.1.1.003                           armhf        Spartan3, XCF and CPLD JTAG programmer and other utilities.
ii  matrixio-zipgateway               2.61.0                              armhf        zipgateway built using CMake
ii  matrixio-zwave-utils              0.2.1                               armhf        Install scripts that can init the Zwave Module in MATRIX Creator.

➜  ~ cat /usr/share/alsa/alsa.conf
#
#  ALSA library configuration file
#

# pre-load the configuration files

@hooks [
        {
                func load
                files [
                        "/etc/alsa/conf.d"
                        "/etc/asound.conf"
                        "~/.asoundrc"
                ]
                errors false
        }
]

# load card-specific configuration files (on request)

cards.@hooks [
        {
                func load
                files [
                        {
                                @func concat
                                strings [
                                        { @func datadir }
                                        "/cards/aliases.conf"
                                ]
                        }
                ]
        }
        {
                func load_for_all_cards
                files [
                        {
                                @func concat
                                strings [
                                        { @func datadir }
                                        "/cards/"
                                        { @func private_string }
                                        ".conf"
                                ]
                        }
                ]
                errors false
        }
]

#
# defaults
#

# show all name hints also for definitions without hint {} section
defaults.namehint.showall on
# show just basic name hints
defaults.namehint.basic on
# show extended name hints
defaults.namehint.extended on
#
defaults.ctl.card 0
defaults.pcm.card 0
defaults.pcm.device 0
defaults.pcm.subdevice -1
defaults.pcm.nonblock 1
defaults.pcm.compat 0
defaults.pcm.minperiodtime 5000         # in us
defaults.pcm.ipc_key 5678293
defaults.pcm.ipc_gid audio
defaults.pcm.ipc_perm 0660
defaults.pcm.dmix.max_periods 0
defaults.pcm.dmix.rate 48000
defaults.pcm.dmix.format "unchanged"
defaults.pcm.dmix.card defaults.pcm.card
defaults.pcm.dmix.device defaults.pcm.device
defaults.pcm.dsnoop.card defaults.pcm.card
defaults.pcm.dsnoop.device defaults.pcm.device
defaults.pcm.front.card defaults.pcm.card
defaults.pcm.front.device defaults.pcm.device
defaults.pcm.rear.card defaults.pcm.card
defaults.pcm.rear.device defaults.pcm.device
defaults.pcm.center_lfe.card defaults.pcm.card
defaults.pcm.center_lfe.device defaults.pcm.device
defaults.pcm.side.card defaults.pcm.card
defaults.pcm.side.device defaults.pcm.device
defaults.pcm.surround21.card defaults.pcm.card
defaults.pcm.surround21.device defaults.pcm.device
defaults.pcm.surround40.card defaults.pcm.card
defaults.pcm.surround40.device defaults.pcm.device
defaults.pcm.surround41.card defaults.pcm.card
defaults.pcm.surround41.device defaults.pcm.device
defaults.pcm.surround50.card defaults.pcm.card
defaults.pcm.surround50.device defaults.pcm.device
defaults.pcm.surround51.card defaults.pcm.card
defaults.pcm.surround51.device defaults.pcm.device
defaults.pcm.surround71.card defaults.pcm.card
defaults.pcm.surround71.device defaults.pcm.device
defaults.pcm.iec958.card defaults.pcm.card
defaults.pcm.iec958.device defaults.pcm.device
defaults.pcm.modem.card defaults.pcm.card
defaults.pcm.modem.device defaults.pcm.device
# truncate files via file or tee PCM
defaults.pcm.file_format        "raw"
defaults.pcm.file_truncate      true
defaults.rawmidi.card 0
defaults.rawmidi.device 0
defaults.rawmidi.subdevice -1
defaults.hwdep.card 0
defaults.hwdep.device 0
defaults.timer.class 2
defaults.timer.sclass 0
defaults.timer.card 0
defaults.timer.device 0
defaults.timer.subdevice 0

#
#  PCM interface
#

# redirect to load-on-demand extended pcm definitions
pcm.cards cards.pcm

pcm.default cards.pcm.default
pcm.sysdefault cards.pcm.default
pcm.front cards.pcm.front
pcm.rear cards.pcm.rear
pcm.center_lfe cards.pcm.center_lfe
pcm.side cards.pcm.side
pcm.surround21 cards.pcm.surround21
pcm.surround40 cards.pcm.surround40
pcm.surround41 cards.pcm.surround41
pcm.surround50 cards.pcm.surround50
pcm.surround51 cards.pcm.surround51
pcm.surround71 cards.pcm.surround71
pcm.iec958 cards.pcm.iec958
pcm.spdif iec958
pcm.hdmi cards.pcm.hdmi
pcm.dmix cards.pcm.dmix
pcm.dsnoop cards.pcm.dsnoop
pcm.modem cards.pcm.modem
pcm.phoneline cards.pcm.phoneline

pcm.hw {
        @args [ CARD DEV SUBDEV ]
        @args.CARD {
                type string
                default {
                        @func getenv
                        vars [
                                ALSA_PCM_CARD
                                ALSA_CARD
                        ]
                        default {
                                @func refer
                                name defaults.pcm.card
                        }
                }
        }
        @args.DEV {
                type integer
                default {
                        @func igetenv
                        vars [
                                ALSA_PCM_DEVICE
                        ]
                        default {
                                @func refer
                                name defaults.pcm.device
                        }
                }
        }
        @args.SUBDEV {
                type integer
                default {
                        @func refer
                        name defaults.pcm.subdevice
                }
        }
        type hw
        card $CARD
        device $DEV
        subdevice $SUBDEV
        hint {
                show {
                        @func refer
                        name defaults.namehint.extended
                }
                description "Direct hardware device without any conversions"
        }
}

pcm.plughw {
        @args [ CARD DEV SUBDEV ]
        @args.CARD {
                type string
                default {
                        @func getenv
                        vars [
                                ALSA_PCM_CARD
                                ALSA_CARD
                        ]
                        default {
                                @func refer
                                name defaults.pcm.card
                        }
                }
        }
        @args.DEV {
                type integer
                default {
                        @func igetenv
                        vars [
                                ALSA_PCM_DEVICE
                        ]
                        default {
                                @func refer
                                name defaults.pcm.device
                        }
                }
        }
        @args.SUBDEV {
                type integer
                default {
                        @func refer
                        name defaults.pcm.subdevice
                }
        }
        type plug
        slave.pcm {
                type hw
                card $CARD
                device $DEV
                subdevice $SUBDEV
        }
        hint {
                show {
                        @func refer
                        name defaults.namehint.extended
                }
                description "Hardware device with all software conversions"
        }
}

pcm.plug {
        @args [ SLAVE ]
        @args.SLAVE {
                type string
        }
        type plug
        slave.pcm $SLAVE
}

pcm.shm {
        @args [ SOCKET PCM ]
        @args.SOCKET {
                type string
        }
        @args.PCM {
                type string
        }
        type shm
        server $SOCKET
        pcm $PCM
}

pcm.tee {
        @args [ SLAVE FILE FORMAT ]
        @args.SLAVE {
                type string
        }
        @args.FILE {
                type string
        }
        @args.FORMAT {
                type string
                default {
                        @func refer
                        name defaults.pcm.file_format
                }
        }
        type file
        slave.pcm $SLAVE
        file $FILE
        format $FORMAT
        truncate {
                @func refer
                name defaults.pcm.file_truncate
        }
}

pcm.file {
        @args [ FILE FORMAT ]
        @args.FILE {
                type string
        }
        @args.FORMAT {
                type string
                default {
                        @func refer
                        name defaults.pcm.file_format
                }
        }
        type file
        slave.pcm null
        file $FILE
        format $FORMAT
        truncate {
                @func refer
                name defaults.pcm.file_truncate
        }
}

pcm.null {
        type null
        hint {
                show {
                        @func refer
                        name defaults.namehint.basic
                }
                description "Discard all samples (playback) or generate zero samples (capture)"
        }
}

#
#  Control interface
#

ctl.sysdefault {
        type hw
        card {
                @func getenv
                vars [
                        ALSA_CTL_CARD
                        ALSA_CARD
                ]
                default {
                        @func refer
                        name defaults.ctl.card
                }
        }
        hint.description "Default control device"
}
ctl.default ctl.sysdefault

ctl.hw {
        @args [ CARD ]
        @args.CARD {
                type string
                default {
                        @func getenv
                        vars [
                                ALSA_CTL_CARD
                                ALSA_CARD
                        ]
                        default {
                                @func refer
                                name defaults.ctl.card
                        }
                }
        }
        type hw
        card $CARD
        hint.description "Direct control device"
}

ctl.shm {
        @args [ SOCKET CTL ]
        @args.SOCKET {
                type string
        }
        @args.CTL {
                type string
        }
        type shm
        server $SOCKET
        ctl $CTL
}

#
#  RawMidi interface
#

rawmidi.default {
        type hw
        card {
                @func getenv
                vars [
                        ALSA_RAWMIDI_CARD
                        ALSA_CARD
                ]
                default {
                        @func refer
                        name defaults.rawmidi.card
                }
        }
        device {
                @func igetenv
                vars [
                        ALSA_RAWMIDI_DEVICE
                ]
                default {
                        @func refer
                        name defaults.rawmidi.device
                }
        }
        hint.description "Default raw MIDI device"
}

rawmidi.hw {
        @args [ CARD DEV SUBDEV ]
        @args.CARD {
                type string
                default {
                        @func getenv
                        vars [
                                ALSA_RAWMIDI_CARD
                                ALSA_CARD
                        ]
                        default {
                                @func refer
                                name defaults.rawmidi.card
                        }
                }
        }
        @args.DEV {
                type integer
                default {
                        @func igetenv
                        vars [
                                ALSA_RAWMIDI_DEVICE
                        ]
                        default {
                                @func refer
                                name defaults.rawmidi.device
                        }
                }
        }
        @args.SUBDEV {
                type integer
                default -1
        }
        type hw
        card $CARD
        device $DEV
        subdevice $SUBDEV
        hint {
                description "Direct rawmidi driver device"
                device $DEV
        }
}

rawmidi.virtual {
        @args [ MERGE ]
        @args.MERGE {
                type string
                default 1
        }
        type virtual
        merge $MERGE
}

#
#  Sequencer interface
#

seq.default {
        type hw
        hint.description "Default sequencer device"
}

seq.hw {
        type hw
}

#
#  HwDep interface
#

hwdep.default {
        type hw
        card {
                @func getenv
                vars [
                        ALSA_HWDEP_CARD
                        ALSA_CARD
                ]
                default {
                        @func refer
                        name defaults.hwdep.card
                }
        }
        device {
                @func igetenv
                vars [
                        ALSA_HWDEP_DEVICE
                ]
                default {
                        @func refer
                        name defaults.hwdep.device
                }
        }
        hint.description "Default hardware dependent device"
}

hwdep.hw {
        @args [ CARD DEV ]
        @args.CARD {
                type string
                default {
                        @func getenv
                        vars [
                                ALSA_HWDEP_CARD
                                ALSA_CARD
                        ]
                        default {
                                @func refer
                                name defaults.hwdep.card
                        }
                }
        }
        @args.DEV {
                type integer
                default {
                        @func igetenv
                        vars [
                                ALSA_HWDEP_DEVICE
                        ]
                        default {
                                @func refer
                                name defaults.hwdep.device
                        }
                }
        }
        type hw
        card $CARD
        device $DEV
        hint {
                description "Direct hardware dependent device"
                device $DEV
        }
}

#
#  Timer interface
#

timer_query.default {
        type hw
}

timer_query.hw {
        type hw
}

timer.default {
        type hw
        class {
                @func refer
                name defaults.timer.class
        }
        sclass {
                @func refer
                name defaults.timer.sclass
        }
        card {
                @func refer
                name defaults.timer.card
        }
        device {
                @func refer
                name defaults.timer.device
        }
        subdevice {
                @func refer
                name defaults.timer.subdevice
        }
        hint.description "Default timer device"
}

timer.hw {
        @args [ CLASS SCLASS CARD DEV SUBDEV ]
        @args.CLASS {
                type integer
                default {
                        @func refer
                        name defaults.timer.class
                }
        }
        @args.SCLASS {
                type integer
                default {
                        @func refer
                        name defaults.timer.sclass
                }
        }
        @args.CARD {
                type string
                default {
                        @func refer
                        name defaults.timer.card
                }
        }
        @args.DEV {
                type integer
                default {
                        @func refer
                        name defaults.timer.device
                }
        }
        @args.SUBDEV {
                type integer
                default {
                        @func refer
                        name defaults.timer.subdevice
                }
        }
        type hw
        class $CLASS
        sclass $SCLASS
        card $CARD
        device $DEV
        subdevice $SUBDEV
        hint {
                description "Direct timer device"
                device $DEV
        }
}

All I can get out of this command is a recording with a whole bunch of clicks. Every other recording I’ve tried either didn’t work (because the instructions referred to “mic_channel0” or “hw:2,0” which aren’t valid on my device)

arecord --device=hw:1,0 -r 16000 -c 1 -f S16_LE test.wav
REALLY LOUD RECORDING

I should mention that I have already tried reinstalling many of the required packages (MALOS and Matrix Kernels) as well as trying to compile them by source, but neither produced anything new to use. I’ve also tried many of the examples in their respective packages (even tried HAL but it said I should use ASLA) node test_micarray.js , python3 recordFile.py , python3 pyaudio_test.py and all of them resulted in some error.

The new 2.50 rhasspy version resolved all the issue so it was version of software what was issue.

1 Like

@Chozandrias,

From your arecord -l output, it seems your MATRIX device is indeed registered as hw:2,0, card 2, device 0 on ALSA. What happens if you try to record and playback with the following commands?

arecord recording.wav -f S16_LE -r 16000 -d 5
aplay recording.wav

I just tested this exact procedure with the latest Raspberry OS and it worked for me. Let me know how it goes.

Best,
Samreen

I record 5 seconds of silence unfortunately. I’m sure this has something to do with how I mangled my RPi to get Zigbee to work. I’m just hoping I don’t have to start all over to get Zigbee and my microphone working.

Is it possible that my microphone is muted or the volume is 0? I tried using amixer to turn on capture and turn up the gain on anything that looked like a “Mic”, but it didn’t seem to effect the recording. I did have a USB microphone plugged in so my card number changed, but shouldn’t I be able to record with this command if the device is set up properly?

➜  misc git:(master) ✗ arecord recording.wav --device=hw:3,0 -f S16_LE -r 16000 -d 6
arecord: main:828: audio open error: Device or resource busy
➜  misc git:(master) ✗ arecord -l                                                   
**** List of CAPTURE Hardware Devices ****
card 1: Dummy [Dummy], device 0: Dummy PCM [Dummy PCM]
  Subdevices: 7/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: MATRIXIOSOUND [MATRIXIO-SOUND], device 0: matrixio.mic.0 snd-soc-dummy-dai-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0

@Chozandrias,

Yes, theoretically, it should work with the command you used given the configuration shown.

The “Device or resource busy” error usually occurs when another program is using the MATRIX mics which I assume is not the case for you?

Could you send me a screenshot of the output from

alsamixer

Are you able to access the MATRIXIO-SOUND card gain using Fn + F6 to select it?

Best,
Samreen


➜  misc git:(master) ✗ arecord -l                                                   
**** List of CAPTURE Hardware Devices ****
card 1: Dummy [Dummy], device 0: Dummy PCM [Dummy PCM]
  Subdevices: 7/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: MATRIXIOSOUND [MATRIXIO-SOUND], device 0: matrixio.mic.0 snd-soc-dummy-dai-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0
➜  misc git:(master) ✗ arecord recording.wav --device=hw:2,0 -f S16_LE -r 16000 -d 6
arecord: main:828: audio open error: Device or resource busy

I did notice that I had pulse-audio installed and it was the default initially so I removed it (and restarted) to get the above screenshots. Still unable to record directly to this device.
Should I try something like this? https://zedic.com/raspberry-pi-usb-webcam-built-in-microphone/

Also, here are all my running processes. Not sure how to single out the ones using the sound device: https://gist.github.com/chozandrias76/4bcdd50612e5a63f2493e0a538bfe0aa

In the meantime, I’m going to flash my other SD card and start from scratch…

After formatting, and reinstalling my basics https://github.com/home-assistant/supervised-installer and https://matrix-io.github.io/matrix-documentation/matrix-creator/resources/microphone/ it became immediately apparent that one of the docker containers was locking the audio. I was able to shut down all the docker containers and then record audio as expected. I tried this process on the other SD card with all of the other setup on it, but it still wasn’t able to access so something got messed up with the OS at some point.

Getting back into Home Assistant, I tried to see if I could set up the Ada voice assistant, but it would never recognize my device. I assumed that it did since one of the docker images locks me out from using it, but I didn’t even consider that I might need to do some extra steps to get a docker image to use sound cards https://stackoverflow.com/questions/28985714/run-apps-using-audio-in-a-docker-container#28985715

Since Home Assistant doesn’t recommend their generic Linux install method anymore anyways,I decided I’m going to try starting over with their image instead of Raspbian and see if I can get all my Matrix hardware working on their Distro. Looks like it runs on Alpine Linux which doesn’t look remotely compatible with the install instructions under Raspbian for the Matrix Creator :unamused:

Since my issue is outside of the scope of @onebigunicorn’s issue, and I was able to record audio in the basic sense, I’ll continue working away and check back in my own thread(s) if needed.

Thanks for all the help @Samreen !

1 Like

I am experiencing the same issues as @onebigunicorn (same error messages). I am trying to get this working on 2.5 rhasspy. I have it working on 2.4, but this doesn’t work on 2.5. I am using a fresh install of Buster and no other docker image is running. @Samreen do you have any thoughts as the previous commands didn’t work

@longunmin,

Do you have the MATRIX kernel modules installed?

Can you show me the output of arecord -l so I can ensure your MATRIX microphones have been detected by ALSA?

Did you make sure to select hw:2,0 hardware, without any software conversions or something along those lines in the Rhasspy browser console?

I have used the MATRIX microphones with Rhasspy 2.5 successfully so I’m positive we can find a solution to whatever is happening!

Best,
Samreen

Yep, I have the kernel installed. Here is the output for the arecord -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: MATRIXIOSOUND [MATRIXIO-SOUND], device 0: matrixio.mic.0 snd-soc-dummy-dai-0 []
Subdevices: 1/1

And then here are my rhasspy settings

{
“dialogue”: {
“system”: “rhasspy”
},
“microphone”: {
“arecord”: {
“device”: “hw:CARD=MATRIXIOSOUND,DEV=0”
},
“system”: “arecord”
},
“sounds”: {
“aplay”: {
“device”: “hw:CARD=MATRIXIOSOUND,DEV=1”
},
“system”: “aplay”
},
“speech_to_text”: {
“system”: “kaldi”
},
“wake”: {
“system”: “snowboy”
}
}

@longunmin,

Everything is looking good on the MATRIX mics detection side and Rhasspy config.

To understand the problem better, when you pause/kill the docker container and try to record using

arecord -f S16_LE -d 5 recording.wav

It is giving you this error?

Can you send me the output of dpkg -l | grep matrix so I can see the MATRIX package installation statuses and also your Linux kernel version uname -a?

Best,
Samreen

Correct, I shut down rhasspy, confirm its down and then get the error message

pi@raspberrypi:~ docker stop rhasspy rhasspy pi@raspberrypi:~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
pi@raspberrypi:~ $ arecord -f S16_LE -d 5 recording.wav
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM input
arecord: main:828: audio open error: No such file or directory

here is the grep output:

pi@raspberrypi:~ $ dpkg -l | grep matrix
ii libmatrixio-creator-hal:armhf 0.3.8 armhf Hardware Abstraction Layer for MATRIX.
ii libswresample3:armhf 7:4.1.6-1~deb10u1+rpt1 armhf FFmpeg library for audio resampling, rematrixing etc. - runtime files
ii matrixio-creator-init 0.4.17 armhf Install scripts that can program the MATRIX Creator FPGA and SAM3 IMU.
ii matrixio-kernel-modules 0.2.4 all Source DKMS for MATRIXIO kernel modules.
ii matrixio-openocd 1.0.1.002 armhf Open on-chip JTAG debug solution for ARM and MIPS systems
ii matrixio-xc3sprog 1.1.1.003 armhf Spartan3, XCF and CPLD JTAG programmer and other utilities.

and then here is the uname output:

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.4.51-v7+ #1333 SMP Mon Aug 10 16:45:19 BST 2020 armv7l GNU/Linux

@longunmin,

Can you share the output of lsmod | grep matrix and the content in your /boot/config.txt file?

Best,
Samreen

Here you go. I should note this is a fresh install of Buster

pi@raspberrypi:~ $ lsmod | grep matrix
matrixio_uart 16384 0
matrixio_codec 16384 2
matrixio_playback 49152 1
matrixio_mic 16384 1
snd_soc_core 200704 3 matrixio_playback,matrixio_codec,matrixio_mic
matrixio_env 16384 0
matrixio_imu 16384 0
industrialio 69632 2 matrixio_imu,matrixio_env
matrixio_gpio 16384 0
matrixio_everloop 16384 0
matrixio_regmap 61440 0
matrixio_core 16384 7 matrixio_everloop,matrixio_regmap,matrixio_playback,matrixio_imu,matrixio_mic,matrixio_uart,matrixio_env
snd_pcm 94208 6 matrixio_playback,snd_pcm_dmaengine,matrixio_mic,snd_bcm2835,snd_soc_core,snd_dummy
snd 69632 15 snd_compress,matrixio_playback,snd_timer,snd_bcm2835,snd_soc_core,snd_dummy,snd_pcm

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
    
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d
# Lines added by matrixlabs_edit_settings.py.
# Commented definitions of the settings might be above.
dtoverlay=spi0-cs,cs1_pin=12
dtparam=spi=on
enable_uart=1
start_x=1
# Lines added by matrixlabs_edit_settings.py.
# Commented definitions of the settings might be above.
dtoverlay=matrixio

Thanks for working through this with me!

@Samreen any thoughts on the above?

@longunmin,

Apologies for the delay.

Has there been any change in your situation?

Everything looks as it should so we need to keep exploring to find the root cause of your issue.

Can you share the output of below?

cat /etc/asound.conf

I would like to make sure your sound config file has not been corrupted in any way.

Could you also check if you have a file called .asoundrc in your /home/pi directory? Use ls -a to check.

Additionally, could you try recording by specifying the sound card and let me know how it goes?

arecord recording.wav -D hw:MATRIXIOSOUND -f S16_LE -r 16000 -d 5
aplay recording.wav

I Googled the specific error you mentioned and found this Rhasspy issue here. The output is a little different but maybe if the above do not work, it could give some direction.

Best,
Samreen

Hi no prob. I figured out the issue. I was using the desktop image of Buster, which runs pulseaudio. I did a fresh install with buster lite and everything is working great now

1 Like