[Solved] MATRIX Voice - Extrem low record

Hello All,

I just received MC. I mounted it on a Rasberry 3
But when I make a recording test via demo HAL or via arecord the voices are recording but very weakly at the limit of the inaudible. (Max 2m)

How do you adjust the gain if it’s possible?

Thank you


did you run
to increase audio playback and recording gain?

Afterwards, running
sudo alsactl store
to store your settings could help as well.

Hi @knoppix1,

If you are using the micarray_recorder.cpp demo you could go into the code and just apply a simple gain (e.g. in line 97).

You could also used the method SetGain() from the MicrophoneArray class, see here

Hi @Nils Hi @yoelrc88

I made the changes in alsamixer (see screenshot) but no change in the record level.
In addition I tested a simultaneous recording with my phone and the matrix voice and it has nothing to call the phone captures 10x better (see spectrum screenshot (left phone on the right the martix voice) …
I am disappointed with the product :frowning:
We are a lot of people in this case.
I do not see how to change the gain for alsamixer with SetGain in microphone_array.h


Hi @knoppix1,

Really cool graphs! Thanks for sharing.

It is hard for me to compare the audio recording just by seeing these two graphs. Few points here:

  • Would be awesome if you share the actual audio files.
  • The graphs don’t have the same scale in the Frequency axis.
  • Difference in the recording frequency (48KHz and16KHz)

Regarding changing the gain as I was telling before, you could try this code:

 * Copyright 2016 <Admobilize>
 * All rights reserved.
#include <gflags/gflags.h>
#include <wiringPi.h>

#include <string>
#include <iostream>
#include <valarray>
#include <unistd.h>

#include "../cpp/driver/microphone_array.h"
#include "../cpp/driver/wishbone_bus.h"

namespace hal = matrix_hal;

int main(int argc, char *agrv[]) {
  hal::WishboneBus bus;

  hal::MicrophoneArray mics;

  mics.SetGain(2); // Try different values for example from 1 to 20.

  return 0;

To use the code above follow instructions in the Readme. You can put the code in one of the demos and build it again. After that, you just have to run that demo.

Let me know if you need more help.


Thank @yoelrc88

After many test,
The gain is well applied after a make make install, I tested a value of 12 but suddenly I had only noise!

But ! Then it’s much better since !! is that the fact that I restarted since (modification alesamixer) or so of the update that I had:
The following packages will be updated:
firmware-atheros firmware-brcm80211 firmware-libertas firmware-misc-nonfree firmware-realtek libmatrixio-protos libmatrixio-protos-dev libtasn1-6

In any case on the chanel one is now audible.

I noticed something if I record on the chanel 8 it’s even better (with a little noise) here are the catches: (right chanel 8 left chanel 1) so I spent the chanel 8 in /etc/asound.conf.

But even so it’s not super quality for a mic array of 8 micro …
I hope we will find a solution

I think I’m facing similar issues, as I need to considerably speak up to make Alexa respond to anything if I’m more than a meter away from the Voice. I’ve everything turned up to 100 in alsamixer, gpio25 value set to 0 and just run apt-get update & upgrade and reboot on my Pi3.

@Sandman, Did you tried the example above using the SetGain() method ?

@yoelrc88 I’m not entirely sure where I should put the gain modification when running the alexa demo. I modified the WakeWordAgent.cpp a bit:

Added #include <matrix_hal/microphone_array.h>

And the gain modification to the mainloop:

void WakeWordAgent::mainLoop() {

  hal::WishboneBus bus;


  hal::MicrophoneArray mics;

  mics.SetGain(7); // Try different values for example from 1 to 20.

and then recompiled the wakeword agent by running cmake . && make -j4

After this modification, however, the wakeword wouldn’t work at all. I had to remove my modifications, run voice_esp32_reset and reboot the Pi to get the wake word working again.

Hello @Sandman

  1. Extrem low record: We just released a new version of the FPGA init https://github.com/matrix-io/matrix-creator-init/releases/tag/v0.4.3 . The default configuration in the FPGA is the 16Khz and we increase the volume in the default configuration. I hope it resolves the main issue.
sudo apt update
sudo apt upgrade
  1. Change the sampling rate and gain: As you notice you could change those parameters. I would recommend using the following table:
Frequency  Default Gain
8000          0
12000         2
16000         3                    
22500         5
24000         5
32000         6
44100         8
48000         8

If you increase the gain parameter you could generate a saturation in the signal.

  1. In this example, it’s mandatory to use a 16Khz sampling frequency.

  2. ESP Reset: You could check: How to reset voice and creator?.

Let me know how the things work.


Kevin Patino

1 Like

Hi @kevindpatino

Unfortunately after apt update & upgrade & reboot, WakeWordEngine does not work anymore.

pi@raspberrypi:~/matrix/alexa-avs-sample-app/samples/wakeWordAgent/src $ ./wakeWordAgent -e sensory
INFO:main: Starting Wake Word Agent
INFO:WakeWordAgent: State set to IDLE(2)
INFO:Initializing Sensory library | library name: TrulyHandsfree | library version: 5.0.0-beta.10.2 | model file: ../ext/resources/spot-alexa-rpi.snsr
WARNING:Library expires on: License expires on 28 May 2018 00:00:00 GMT
ALSA lib pcm_file.c:760:(snd_pcm_file_open) open /tmp/matrix_micarray_channel_0 for reading failed: No such file or directory
INFO:SensoryWakeWordEngine: mainLoop thread started
ERROR:An error happened in the mainLoop of SensoryWakeWord snsrRun(): task: Input channel audio-pcm: ALSA error: No such file or directory
INFO:SensoryWakeWordEngine: mainLoop thread ended
INFO:WakeWordIPCSocket::mainLoop thread started
INFO:WakeWordIPCSocket: init socket on port:5123
INFO:===> Connected to AVS client <===
INFO:WakeWordAgent: thread started

Additional information:

pi@raspberrypi:~ $ sudo dpkg --list | grep matrix
ii  libmatrixio-creator-hal:armhf         0.2.1                                      armhf        Hardware Abstraction Layer for MATRIX.
ii  libmatrixio-creator-hal-dev           0.2.1                                      armhf        Hardware Abstraction Layer for MATRIX (headers)
ii  libmatrixio-malos:armhf               0.1.2                                      armhf        Libraries of MATRIX abstraction layer for MOS
ii  libmatrixio-protos:armhf              0.1.1                                      armhf        Protocolbuffers for MATRIX abstraction layer
ii  matrixio-creator-init                 0.4.4                                      armhf        Install scripts that can program the MATRIX Creator FPGA and SAM3 IMU.
ii  matrixio-malos                        0.3.0                                      armhf        Allows queries to MATRIX Creator hardware via ZMQ.
ii  matrixio-openocd                      1.0.1                                      armhf        Open on-chip JTAG debug solution for ARM and MIPS systems
ii  matrixio-protobuf                     3.4.0                                      armhf        Protocol Buffers - Google's data interchange format. (From GRPC 3.4.0)
ii  matrixio-xc3sprog                     1.1.1                                      armhf        Spartan3, XCF and CPLD JTAG programmer and other utilities.

pi@raspberrypi:~ $ /usr/share/matrixlabs/matrixio-devices/fpga_info
IDENTIFY = 6032bad2
VERSION = 10006

can you perform this:

sudo systemctl status matrixio-malos.service
# check if it is running
# if not
sudo systemctl start matrixio-malos.service

@loom thanks for the tip. Malos was not running, this was the status before I started it again:

pi@raspberrypi:~ $ sudo systemctl status matrixio-malos.service
● matrixio-malos.service - Matrix Abstraction Layer for OS
   Loaded: loaded (/lib/systemd/system/matrixio-malos.service; enabled)
   Active: failed (Result: signal) since Thu 2018-02-15 11:39:09 UTC; 1h 57min ago
  Process: 1155 ExecStart=/usr/bin/malos (code=killed, signal=FPE)
 Main PID: 1155 (code=killed, signal=FPE)

Feb 15 11:39:09 raspberrypi malos[1155]: MALOS starting
Feb 15 11:39:09 raspberrypi malos[1155]: **************
Feb 15 11:39:09 raspberrypi malos[1155]: You can query specific driver info using port 20012.
Feb 15 11:39:09 raspberrypi malos[1155]: Registered driver IMU with port 20013.
Feb 15 11:39:09 raspberrypi malos[1155]: Registered driver Humidity with port 20017.
Feb 15 11:39:09 raspberrypi malos[1155]: Registered driver Everloop with port 20021.
Feb 15 11:39:09 raspberrypi malos[1155]: Registered driver Pressure with port 20025.
Feb 15 11:39:09 raspberrypi malos[1155]: Registered driver UV with port 20029.
Feb 15 11:39:09 raspberrypi systemd[1]: matrixio-malos.service: main process exited, code=killed, status=8/FPE
Feb 15 11:39:09 raspberrypi systemd[1]: Unit matrixio-malos.service entered failed state.

Now the wake word agent responds to the Alexa wake word, however nothing gets recorded after that. I hear the sound cue from Alexa, the LEDs change color, but my voice does not get recorded. When I play back the messages from Alexa App’s history feature, I hear nothing.

Your wakeword engine example will not record anything, it’s just an implementation of a sensory wakeword engine for the alexa service, to run it in handsfree mode. Which means it is only informing the alexa avs service, if a wakeword was detected. The rest is handled in this case by the alexa service itself.

here is the full installation guide:

Ok, thanks for the clarification.
And yeah I followed the hackster guide previously and had Alexa demo up and running without a hitch, don’t know why it broke now. Restarted my Pi3 and that did the trick.

For some reason the matrixio-malos.service seems to crash on every boot now, so I have start it manually every time.