I want to record sound using the microphone array. The first thing I tried was running the micarray_recorder demo. I can successfully record and convert the output files to .wav and listen to them on a computer (or on the pi).
However, the output is very noisy. There is a high frequency component–a square wave, which I notice as a buzzing sound during playback. I listened to all 8 audio channels and they all have the noise. I was able to cut down some of the noise by disabling WiFI and using a wired connection. But I can’t get a clean recording, i.e. no noise.
I also tried recording with arecord which, I think, uses ALSA to capture sound. The recordings sound better and don’t have as much noise (still a little bit but much better).
A couple of questions:
Can others record “clean” sound when using micarray_recorder?
Is arecord capturing sound using one of the microphones on the matrix creator board?
Otherwise, does the ALSA driver perform filtering such that it removes the sound?
Is it possible to record all 8 channels when using arecord?
I’d like to second this, and also add one observation. In my tests, the micarray_recorder recordings have the following properties:
The square wave consists of discrete, and quite inconsistent / non-periodic, jumps at what I believe are buffer boundaries (i.e., every 128 samples);
This effect is not consistent across different microphones; with my setup, Mics #2 and #7 suffer from this much less than the rest.
For short snippets with mostly silence on the buffer boundaries, manually adjusting for these jumps produces a moderately cleaner sound. (Though of course this skews the overall energy, and can produce significant aberration when there is a non-trivial sound at a buffer boundary.)
Thanks Anatoly. You are correct, the “jumps” happen on many (most?) buffer boundaries. Looking through the code for malos I realized that it is always dumping sound data to named pipes in /tmp (see matrix-creator-malos/src/driver_micarray_alsa.cpp).
I haven’t poked around the code enough to understand how it is all supposed to work, but I think what is happening is that two processes are reading the sound data and neither gets the entire stream. If I kill the malos process (there are two versions of it running on my raspberry pi), I can record “clean” sound from micarry_recorder. This also explains why I got clean sound when using record (only one process was listening to the audio stream).
Perhaps the “correct” way to record sound is to read from the named pipes in /tmp. One problem with this option is how to synchronize the channels.
I had the same problem as you two and found this thread
thanks ricardog, you indeed identified the source the problem.
since I’m developing with only HAL (old school C++), so I don’t really bother with MALOS and went ahead to just uninstall the package, which did the trick for me! The recording is now very much clean