[Solved] How to start recording

Is there currently a way to start recording using the mic array with arecord ? (Also just using one mic would be currently enough)

If not, will it be implemented at some time?

I’m trying to record audio with NodeJs using the mic array.

Any help or suggestion is very welcome!

Hi Carlos,

We are currently working to support ALSA, we will have that ready within the next days. So you will be able to use arecord soon with our Matrix Creator.

My suggestion is first to play with the current mic array demo in https://github.com/matrix-io/matrix-creator-hal/blob/master/demos/micarray_recorder.cpp and stay tuned with the community to use arecord when ALSA support is ready.




Awesome, can’t wait to use it with ALSA !
Will it directly Beamforming etc with ALSA?

Our first attempt will be to support ALSA. So, beamforming will not be implemented. But the good news is that we are working on beamforming for future releases !!.


1 Like

Any updates with ALSA support? Do you think snowboy.kitt.ai hotword detection will be possible then?

Hi @adrianlee

We have good news, now we complete ALSA support with MATRIX Creator, now we are working with debian package and update it.

So wait for our new release!!! Its coming!!!



Hi @adrianlee and @Mexolotl, we are excited to announce that ALSA support is ready !!
Just need to do:
sudo apt-get update upgrade
sudo reboot

After reboot, you can use arecord like this:
arecord --device=mic_channel1 -r 16000 -c 1 -f S16_LE test.wav

Enjoy this feature and show us your project here in the community !!


1 Like

Hi yoelrc88, thanks for the update.

This is my ~/.asoundrc:

pcm.bcm2835 {
        type hw
        card 0

pcm.!default {
        type asym
        playback.pcm "bcm2835"
        capture.pcm "mic_channel0"

arecord worked with --device=default. But I’m unable to use the microphone with the PyAudio library (and possibly PortAudio). I have tried the python samples for Google Cloud Speech and other libraries that made use of PyAudio.

I always end up with this error:

ALSA lib pcm_file.c:358:(snd_pcm_file_write_bytes) write failed: Bad file descriptor
ALSA lib pcm_file.c:358:(snd_pcm_file_write_bytes) write failed: Bad file descriptor
ALSA lib pcm_file.c:358:(snd_pcm_file_write_bytes) write failed: Bad file descriptor
ALSA lib pcm_file.c:358:(snd_pcm_file_write_bytes) write failed: Bad file descriptor
python: pcm_file.c:397: snd_pcm_file_add_frames: Assertion `file->wbuf_used_bytes < file->wbuf_size_bytes' failed. 

I’m quite puzzled by the bad file descriptor error and was wondering if the team has any idea regarding this. It would be great to get the snd_dummy source for debugging purposes too.

Hi @bagofchips,

Its great that your are playing with the mics and are trying to use Google Cloud Speech with Matrix Creator.
Our recommendation about your problem is to update MALOS, remove the ~/.asoundr file and test again. Please check if you have the latest release of our debian packages. Always check if the MALOS service is running, now in the last release it starts automatically.

Let me know if you have any other problem.




I’ve done the above but am still running into the same problem. It would be great if anyone could verify this.

thanks @yoelrc88 works fine!!!

With my node module, I can get an audio stream now directly from the mic array :slight_smile:
( https://www.npmjs.com/package/node-microphone )

Also is already supported? I have tried to use Jarvis on my Matrix Creator, but it cannot find the microphone, probably because its an array of them. Well, it sees there are 8, but does not seem able to use any of them properly:

There is a branch with PocketSphinx for the Matrix Creator Hal, but it wont work for me.

Another option might be Snowboy:

I have not tried it yet, but I expect it will at least have same problem as Jarvis.

So, if ALSA support is already in the new update, I guess it does not just work as a way for anything that wants a microphone to be able to just see the whole array as one microphone?


I suggest you avoid most of the samples that utilise PortAudio. One way to work around this problem is to use nodejs packages such as ‘node-record-lpcm16’ or ‘mic’ (the latter allows you to specify which mic to use). As these packages use linux commands i.e (‘rec’, ‘sox’ or ‘arecord’), you will get some stuffs done.

Using the whole microphone array is still an issue for me though. As of now, I am trying to figure out the right alsa configuration to get this working. If the devs here can help, that’d be great.

Hi @Caldor

Have a look here:
I progress on making work with arecord, then i need to try with Jarvis but i need to read Alsa doc to have a clean/nice alsa config to get the right default play device and record device.

That looks interesting. Good to see some progress. I might experiment a bit with making some use of IR to take commands and make it possible to code the Matrix Creator to control the TV by running commands for it, but more than that, but as long as I cannot get something like the PocketSphinx or similar to work, I think I have to wait with getting my main plans for the Matrix Creator to work. Besides I got some other work I probably need to focus on first anyway.

Another alternative to what @Caldor mentioned: Sonus, which has offline keyword spotting and streaming recognition.

Would love to see beam-forming work with this!

@Mexolotl have you tested your module on Raspbian yet? I’d be interested in using it for Sonus :slight_smile:

Hey @evan,
great to see you here :slight_smile:
Yes I’m using it on my raspi 3, node-microphone compared with your snowboy module.
So it should also greatly work with sonus!

I’m using it in this way (mic_channel1 is the specific matrix creator channel):
const audioOptions = {
“endian”: “little”,
“bitwidth”: “16”,
“encoding”: “signed-integer”,
“rate”: “16000”,
“channels”: “1”,
“device”: “mic_channel1”
const Microphone = require(‘node-microphone’);
const mic = new Microphone(audioOptions);

1 Like

@evan @Mexolotl

Did you guys get sonus working on matrix? If yes, can you give some instructions. I got pocketshinx working, but would like to use sonus with snowboy for hotword detection, and then direct to pocketphinx or Google Cloud Speech depending on command

I did not tried sonus. But I got the node module snowboy working (thanks to evan) :slight_smile:

I have been trying to get PocketSphinx working, but have so far failed. I have asked for help in another thread.

Anywhere to get help on how you got keyword recognition working on the Matrix? Like a guide on how to use Snowboy or something?