Copyright Erkki Seppälä [email protected] 2021
Licensed under the MIT license.
A tool for helping with teleconferencing, when you have loud input devices. Such as a mechanical keyboard..
It works by inputting a jack stream from microphone, and then directly connecting all key-producing devices from /dev/input. Then when an input arrives, its timing is checked and muting is applied for the pre-configured duration. Finally the module outputs a jack stream that can be used in place of the microphone.
But that's not all! Not only is it able to mute the clicks, it's also able to unmute the clicks and mute everything else. With a click of a button you can let your colleagues enjoy the sweet sounds of your keyboard rig, while not being distracted by your other sounds, or speech. Use the "Invert muting" function for this.
To work this of course needs a short delay. For me a 45-millisecond
buffer is enough, and Pipewire is configured with
PIPEWIRE_LATENCY=128/48000
.
If the Ubuntu 20.04 -based binary on the GitHub releases page works for you, maybe use that? Otherwise:
sudo apt-get install ca-certificates curl file \
build-essential autoconf automake autotools-dev \
libtool xutils-dev libssl-dev git pkg-config \
libncurses-dev
-
Install the Rust compiler with Cargo e.g. with https://rustup.rs/
-
sudo apt-get install libglvnd-dev libxi-dev libjack-jackd2-dev
-
cargo install --git https://github.com/eras/ClickMuteJack
-
$HOME/.cargo/bin/click_mute
has now been installed
- create a source that is visible in the PulseAudio side:
pactl load-module module-null-sink \
media.class=Audio/Source/Virtual \
sink_name=my-source \
channel_map=front-left,front-right
-
Set up the
qjackctl
patchbay so thatclick_mute
is connected tomy-source
input and your microphone is connected toclick_mute
input and activate the patchbay. -
Set
my-source
as the default input in your audio control tool, such aspavucontrol
-
Maybe restart your browser to re-enumerate audio devices; it seems the
pactl
command does not cause a plug-in event to make it happen automatically. -
Boom, you can use https://online-voice-recorder.com/ to test if it works.
If you just want to test (even more) locally, instead connect the
click_mute
output directly to your speakers. Be aware that this can
cause an audio loop.
Results not satisfactory? Adjust the parameters mute_offset_seconds
and mute_duration_seconds
in click_mute.rs
.
The current settings can be saved (as they are loaded) with the
Save-button to click_mute.ini
in the XDG directory, so likely
$HOME/.config/click_mute/
. However, if a click_mute.ini
exists in
the current working directory, it will be used instead, for both
loading and saving. You can find the defaults from
click_mute.ini.example.
You may change the configuration file to use with the --config
switch. --help
works also.
mute_offset
: number of seconds from the reception of the keyboard
event, to the time when we fade the microphone out. Due to delays
involved, this number can be negative. The default value is -0.045, so
45 milliseconds before the event, and it's a number that works on my
setup.
mute_duration
: for how many seconds to mute the mic? 0.05, or 50
milliseconds, works for me.
fade
: abruptly adjusting volume results in popping sound, so this
tells how many seconds to spend in fading in/out. A small value like
0.010 for 10 milliseconds is good.