Ubuntu – How to control speaker balance or disable one speaker


I have a laptop with two speakers: one is blown and playing unpleasant distorted sound.

How do I permanently deactivate it or control it using balance?

A terminal command is preferred, I reckon.

Also, I use Gnome's basic sound settings and PulseAudio Manager. The latter is used to maximize volume, because the former does not allow me to go beyond 150%. But when I use PulseAudio Manager, it automatically rebalances the speakers to 50%/50%. So, any solution must be permanent enough so PulseAudio Manager cannot alter the balance.


Best Answer

I don't know any way to lock a control with ALSA or PulseAudio, but this little hack should work:

stdbuf -oL alsactl monitor | \
while read; do
    amixer -D pulse sset Master 0,-

It watches for volume changes using alsactl monitor (you can run this command yourself and change the volume to see what it does), and every time a change is made, it resets the volume of the left channel to 0.

You may need to change:

  • pulse to something else if you're using a different audio device.

  • 0,- to -,0 if you want to keep the right channel muted instead.

  • Master to something like Speaker,0 if you want a secondary control (e.g. headphones) to work as normal.

You can make the script run at startup by:

  1. Putting it in a file, e.g. ~/.bin/alsa-fix,
  2. giving the file permission to be run: chmod +x ~/.bin/alsa-fix, and
  3. adding the line ~/.bin/alsa-fix & to ~/.profile.

The script should use virtually no CPU or RAM, but if you want to make it even more efficient, you can probably run it with dash by adding the line #!/bin/dash to the top of the file.

Related Question