Multiple Apps Can Use Mics & Individually Addressable Mics!

Dear MATRIX Community,

Due to a recent push by a community member on the MATRIX kernel modules, you can now:

  • Separately record from each mic in ALSA
  • Have more than one application use any number of your MATRIX device microphones!

The above two items are among our most heavily requested features and enable makers, developers, and companies to leverage numerous applications.

A big shout out to the developer who cracked this difficult problem. It speaks to the strength of our open-source software ecosystem and this community.

To get started with utilizing these features, ensure you have the latest kernel modules, version 0.2.3.

You can check your MATRIX kernel module version with the following command:

dpkg -l | grep matrix

If needed, upgrade your package:
First update:

sudo apt update

Then purge old kernel modules:

sudo apt purge matrixio-kernel-modules

Then reboot for changes to apply:

sudo reboot

Install new kernel modules:

sudo apt install matrixio-kernel-modules

Then reboot for changes to apply:

sudo reboot

Your /etc/asound.conf file should now have the following:

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

To record from a specific channel, use the following command (channel_2 for second mic, channel_3 for third mic and so on):

arecord -f S16_LE -c 1 -Dplug:channel_1 one.wav

To record from all channels, use the following command:

arecord -f S16_LE -Dplug:all_channels -c 8 all.wav

And they run at the same time! You can use the asound.conf template to create many more plugs that can record at the same time.

Let us know if you have any questions. We are excited for the community to start utilizing these awesome features and are ever grateful for you!

Best,
Team MATRIX

1 Like

i get this error:

pi@raspberrypi:~ $ arecord -f S16_LE -c 1 -Dplug:channel_1 one.wav
ALSA lib pcm_direct.c:1824:(_snd_pcm_direct_get_slave_ipc_offset) Invalid value for card
arecord: main:828: audio open error: No such file or directory

arecord -l gives me

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

Hi @ionu,

Have you made sure to install the latest version of the matrixio-kernel-modules package? From your arecord -l output, it would seem the MATRIX mics have not been detected.

Can you send me the output of the following? It will help me see if all the packages installed properly
dpkg -l | grep matrix

Best,
Samreen