1

What's the generic way to mute/unmute my system's default sound output?

$ amixer set Master mute
amixer: Unable to find simple control 'Master',0

$ amixer scontrols
Simple mixer control 'IEC958',0
Simple mixer control 'IEC958',1
Simple mixer control 'IEC958',2
Simple mixer control 'IEC958',3
Simple mixer control 'IEC958',4
Simple mixer control 'IEC958',5

I know the sound control had been moving away from amixer to Pulseaudio, however, I'm still able to use the ALSA "Master" control in my Debian 10, but not my Ubuntu 21.10, see above.

There is pactl set-sink-mute 0 1 from https://superuser.com/questions/805525/, but I tried it but that doesn't work for my Ubuntu 21.10 above.

All in all, I just need a generic way to mute/unmute my system's default sound output that is good across all my machines and all my Linuxes, just like the ALSA "Master" control.

3 Answers 3

5

I've been using this command for ages now:

pactl set-sink-mute @DEFAULT_SINK@ toggle

This mutes/unmutes depending on the current state.


Also to increase volume: pactl set-sink-volume @DEFAULT_SINK@ +3% or decrease volume: pactl set-sink-volume @DEFAULT_SINK@ -3%

3

to mute:

pactl set-sink-mute `pactl get-default-sink` 1

to unmute :

pactl set-sink-mute `pactl get-default-sink` 0
0

With the toggle option, it mutes everything. However, toggle Master does not unmute everything.

So, if we toggle Master, and always unmute the sub-channels, then Master will toggle, and the (sub-) channels will always unmute.

So I made a 3 line script ::

will@will:~$ cat toggle 
amixer -c 1 set Master toggle
amixer -c 1 set Headphone unmute
amixer -c 1 set Speaker unmute

enter image description here

Then bind the script to the key ... because I'm to lazy to press the Fn - mute / vol+ / vol- combination for my keyboard.
enter image description here

3
  • Thanks but please note my "amixer: Unable to find simple control 'Master'" in OP. Welcome aboard anyway.
    – xpt
    Commented Oct 24, 2022 at 16:01
  • You didn't specify the card ? '-c 1' in my example
    – Will Cline
    Commented Oct 25, 2022 at 17:29
  • OK, but I don't have the environment anymore to test your command. Thanks though. BTW, please run amixer scontrols and post your result.
    – xpt
    Commented Oct 26, 2022 at 14:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .