[Solved] Muting the microphones


#1

Hello,

I am working with a Matrix Voice.
I was wondering if there was any function/method to mute the microphone in the HAL/Core libraries?
I can’t seem to find anything that resembles that.
What I am trying to do is work with Snips and once I press a button (a signal goes to the Matrix GPIO) I recognize the pressed button and now I’m stuck at how do I mute the microphone. As I don’t want any sounds going to the assistant.

Thanks for helping,


#2

Hey @Yenshu,

We don’t provide a mute function in our libraries. However, since Snips requires the MATRIX kernel modules on your Raspberry Pi, you can access the microphones through alsa.

I haven’t tested it, but the following terminal commands might be helpful

# Mute
amixer set Capture nocap

# Unmute
amixer set Capture cap

Alternatively, you can either manually start/stop the snips service or have your button trigger a boolean value to ignore MQTT messages from snips.


#3

Hi,

So I have tried the terminal commands, but they didn’t work as the microphone has no mixer set. Do I need to do something in particular to have the microphone in the mixer ?

Finally I kind of resolved my issue by publishing on the Snips Hermes topic

hermes/hotword/toggleOn
hermes/hotword/toggleOff

Not exactly what I was hoping for as a solution, now Snips doesn’t wake on the hotword. But sound still passes through Snips.


#4

@Yenshu,

I’m glad you found a solution!

For the amixer method, first check if you have a file in /etc called asound.conf. If not, create that file and fill it with these contents. Then type the following command to record with the “mic” device we defined in asound.conf which uses the MATRIX device microphones.

arecord -D mic -c8 -f S16_LE test.wav

Running the above command will allow alsa to remember the mic and it will show up on amixer as “MicArray Master”, you can check this by typing just amixer in the terminal.

You should then be able to mute it by typing the following:
amixer set "MicArray Master" 0%
and unmute it by typing the following
amixer set "MicArray Master" 100%

Best,
Samreen