Matrix Creator Microphone issues

Hi there,

It’s probably something quite simple but I can’t quite grasp the issue. Long story short, I’ve built a container based app running with priviledges which captures the microphones and outputs to a pipe. Essentially it’s based on the example available here:

The issue is that the sound is just plain awful. It’s full of crackling and can’t figure what next I could tweak.

The code is available here:

The container is started using this command:

pi@pi:~/ $ docker run -d --privileged --restart always -v $PWD/config:/usr/src/app/.config -v /tmp:/tmp -e SAMPLING_RATE=96000 -e GAIN=0 -e DEBUG=INFO:*,ERROR:*,--not-this --network host

Sample files can be obtained here:
[](96khz 16bits)
[](96khz 8bits)

Notice the 8bits 96khz is closer to the real thing however the crackling is unbearable.

The mic data is captured using a simple tail:

pi@pi:~/ $ tail -f /tmp/m_matrix_micarray_channel_7 > music.raw
pi@pi:~/ $ sox -r 96000 -e unsigned -b 8 -c 1 music.raw music.wav
pi@pi:~/ $ docker logs happy_noyce
0 [0x76fa6220] INFO athena_pi_voicerecorderapp null - Voice Recording App Started.
* Debug setting up
INFO: [/dev/spidev0.0] was opened
* Debug configured bus
* Debug setting sampling rate 96000
* Debug setting gain 7
unable to create /tmp/m_matrix_micarray_channel_0 FIFO.
Audio Configuration:
Sampling Frequency: 96000
Gain : 7
* Debug finished setup 0
* Debug starting up

Can any of you give me some pointer on what’s going on? I would like to be able to capture a somewhat clean audio without crackling. Is there something I’ve missed?




Got it fixed. If it captures using a sr of 16khz it works, as per post here: Thus the subquestion is: why only 16khz seems to work fine?



1 Like

Hello @EtienneB

First is not clear to me what are you using the audio for or if you need to specifically access the raw audio data in this way. To record audio you have many options. You can use HAL directly from C++ as you have been doing following the examples in github, also you can use the ALSA interface to record audio either from an application (arecord, audacity, etc) or using ALSA Library API from C++.

For recording audio I would recommend using tools like arecord and Audacity(GUI). If you need to access to audio data dynamically inside a software I recommend using the ALSA Library. For other languages like python, nodeJS and other look for ALSA wrappers available. In general using ALSA will be better for managing the audio stream than using the examples in HAL, these are small examples to ilustrate how to access raw data read from the board and could be hard to use into more complex applications without a considerable amount of work.

Regarding frequency support, you can record from 8kHz to 48Khz without any issues. Currently, 96Khz is not supported for some bandwidth constraint that is been worked on.

Let me know if this helped and if you have additional quetions.