Skip to content

SimonSeider/input-gain-fix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

input-gain-fix

I got absolutely fed up with a bug in Linux audio where plugging in or unplugging any audio output device resets every single microphone's input gain to 100%. I have lost count of how many times I ear-raped my friends in a Discord call because my mic suddenly started clipping at full blast just because I connected my Bluetooth headphones or plugged in a USB DAC.

This happens on PipeWire/WirePlumber (the default audio stack on Arch and most other distros) when a device hotplug triggers a route re-evaluation and the default source volume of 1.0 (100%) gets applied before the saved state can be restored. Sometimes the restoration just doesn't happen in time and you're left screaming into your friends' ears.

What this fix does

Two layers:

  • WirePlumber config - overrides the dangerous device.routes.default-source-volume from 1.0 to 0.25. Even if a hotplug reset occurs, your mic defaults to 25% instead of 100%.

  • Polling guard daemon - a systemd user service that checks all input sources every second. If any source jumps to 100%, it's instantly reverted to the last known safe volume. Volumes are persisted to disk so they survive reboots.

Requirements

  • PipeWire + WirePlumber 0.5+
  • pactl (from pipewire-pulse or pulseaudio-utils)

Install

cd ~/input-gain-fix
chmod +x install.sh
./install.sh install
systemctl --user restart wireplumber

Uninstall

./install.sh uninstall

Status

./install.sh status

What it looks like

[16:15:13] Guard: restoring alsa_input.pci... from 100% -> 40%

The guard remembers the last volume you set that wasn't 100%. If a source suddenly hits 100% it restores it immediately. If you actually do want 100%, just set it 3 times and the guard will stop fighting you.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages