5

I am trying to mute and unmute using amixer command at terminal in Linux.

The command used to mute:

 amixer sset 'Master' mute

AND

amixer set Master mute

Both worked...

But when I try to unmute:

amixer sset 'Master' unmute

AND

amixer set Master unmute

It doesn't work and volume is still mute.

Both unmute code lines tried return this output in the terminal:

Simple mixer control 'Master',0 Capabilities: pvolume pvolume-joined pswitch pswitch-joined Playback channels: Mono Limits: Playback 0 - 87 Mono: Playback 87 [100%] [0.00dB] [on]

How can I make amixer works to unmute and why it doesn't toggle off? It is amixer the better command to control volume in Linux OS*? If not what tool better instead of amixer?

*Note: Linux OS in general, because it should work to all Linux distro with the less chance to incompatibility and code variation to mute/unmute sound.

1
  • In the examples you show, you can leave out the quotes ('). You need quotes only when you’re using shell variables, command substitutions, and strings with certain non-alphanumeric characters. – Scott Oct 24 '18 at 4:46
8

from this post Arvydas write :

For some reason, muting works fine, but unmuting or toggle has no effect. Upon further investigation I noticed that by muting Master channel, “PCM” and “Master Mono” channels are muted too. Unmuting Master does not unmute those two channels.

That work for me on ubuntu 14.04 (qtile WM) to unmute :

pactl set-sink-mute 0 0

to mute:

pactl set-sink-mute 0 1

Updated:

There a lot of reports on this issue Bug #1026331 and Bug #878986 in launchpad , if you mute/toggle master:

amixer set Master mute

Other channels(Headphone and Speaker in my case) will mute also. but if you unmute/toggle Master :

amixer set Master unmute

the Other Channels will stay mute , but if you try unmute Headphone and Speaker channels sound will come back

amixer set Master unmute
amixer set Headphone unmute
amixer set Speaker unmute
2

xdotool can be troublesome sometimes, fortunately PulseAudio now provides commands for volume regulation and mute.

try this command: pactl set-sink-mute 0 toggle to toggle mute.

Source: https://wiki.archlinux.org/index.php/PulseAudio#Keyboard_volume_control

0
1

I have discover the "xdotool" to simulate media keys. It's simple, because is the same code to toggle mute:

xdotool key XF86AudioMute

And it show the visual notification...

So for further uses of "xdotool":

https://askubuntu.com/questions/235126/simulate-media-keys-in-terminal

-1
amixer -D pulse set Master 1+ toggle
3
  • 1
    I do not get it – Pierre.Vriens Oct 24 '18 at 4:14
  • Found from this thread: askubuntu.com/questions/65764/… – ml_chai Oct 24 '18 at 5:49
  • 2
    Welcome to Super User. I think that what Pierre was hinting at is that just a command line isn't a great answer (even if it's correct). People often misinterpret questions, so the reader can't be sure it's even an answer to the right question, or whether there might be assumptions or limitations that would affect the next reader's ability to apply it to a slightly different case. Aside, from that, a good answer educates the reader so they understand why and how it's the solution, so they might be able to answer the next variation themselves. Can you add some explanation? Thanks. – fixer1234 Oct 24 '18 at 6:36

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.