I got myself an usb footswitch to control my microphone, and not get too much background noise in conversations.

The basic idea is to push the footswitch and hold it down when talking, and release it to mute the microphone.

Configuration of the footswitch

The footswitch can act either as a mouse or a keyboard (it exposes both HID profiles). There is a couple utilities to configure it. I used footswitch from Radoslav Gerganov.

It is now available in nixpkgs.

Its usage is pretty straitforward:

$ footswitch -2 -m ctrl -k XF86WWW

which allows me to have the pedal issue the WWW key (available on some keyboard, which I don’t use) along with the Ctrl modifier.

Control the audio interface

Now, all we need is to send an unmute to pulseaudio/pipewire whenever the key is pressed down, and mute when released. I’m relying on my window manager sway to do that for me.

# sway/config

bindsym --no-repeat Ctrl+XF86WWW exec @pulseaudioFull@/bin/pactl set-source-mute 'alsa_input.usb-RODE_Microphones_RODE_AI-1_33422F01-00.mono-fallback' 0
bindsym --release Ctrl+XF86WWW exec @pulseaudioFull@/bin/pactl set-source-mute 'alsa_input.usb-RODE_Microphones_RODE_AI-1_33422F01-00.mono-fallback' 1