4

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.

Thanks.

3

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,-
done

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.

5
  • 1
    A lot of the above is untested, so let me know if it doesn't work for you, and I'll try to help you out. – Zaz May 31 '15 at 16:02
  • Thanks, this is more than long overdue. I still haven't gotten around to it. If I do, I will ask for more details. – user296844 Dec 8 '16 at 16:13
  • alsactl monitor requires root permission if I'm not mistaken. Not sure how to get it to work for regular users. – domsson Jan 21 '18 at 22:23
  • Nice one! I had to make a couple of changes to run alsactl as non-root and to pick the correct device name, here is the version that worked for me: stdbuf -oL /usr/sbin/alsactl monitor | while read i; do amixer -D default sset Master 0,-; done – We Are All Monica Jun 29 '19 at 5:57
  • Here the answer worked fine without root. Running on arch Linux though. Anyhow, thanks for the suggestion, worked great. Just a minor beep on the left channel when changing the volume while listening to music, but not a big issue at all. Thanks! – jpnadas Dec 21 '19 at 10:34
1

There is a right and left balance control in the GUI interface for sound. Your question seems to indicate you prefer a terminal command, and so if that's the case I can't help you. However if you are merely determined to mute one of your speakers you should be able to configure that in your sound settings. Merely click once on the speaker icon at the top of your screen and click on sound settings.

6
  • Thanks. However, read above the comment on Alsa undoing this everytime I change the master volume. A more permanent solution is needed. – user296844 Jan 5 '15 at 2:22
  • I have not experienced sound settings resetting after changing volume or even rebooting but then I'm using 12.04 currently, and it seems a lot of things about Ubuntu changed (for the worse I fear) with the latest LTS version. – gyropyge Jan 5 '15 at 2:23
  • I figured amixer is a good choice, if I can simply mute one speaker. But I need to know the command to do so. Thanks. – user296844 Jan 5 '15 at 2:28
  • I'll be watching this thread as I'm sure that someday I'll need to know the command you seek. In the meantime I looked up this device that a friend uses. This an all-in-one clip-on pair of stereo speakers that plug into the headphone jack and amplify independently using USB power. It is not to be mistaken with similar devices which solely plug into the usb connector and are driver dependent (not all such devices work with Ubuntu, unfortunately). amazon.com/Microlab-Portable-Amplified-USB-Powered-Notebook/dp/… – gyropyge Jan 5 '15 at 2:32
  • I bought one but the sound felt cheap. Let's see if someone can help with the command. – user296844 Jan 5 '15 at 2:35
0

usual command for amixer to set levels has one value used for all channels, but can use two different values

for example: I set line in capture for a mono mic on my hardware with

amixer set -c 0 Line 42,0

use amixer command or alsamixer to find device id number for -c option
and name of ALSA mixer element to replace 'Line'

Can use percentage or dB values too
In this case Values of '46%' or '0dB' instead of '42' get same result

If Pulseaudio still causes changes in ALSA level
Use Pulseaudio Volume Control pavucontrol
go to Output Devices tab
click padlock to unlock channels to set channel levels

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.