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.

share|improve this question
up vote 6 down vote accepted

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
share|improve this answer

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

share|improve this answer
    
Welcome to SuperUser! Thanks for posting. – hBy2Py Jun 30 '15 at 14:07

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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