Silence Please

From time to time while working on Linux machines remotely I have need to silence their audio output and not disturb or startle those near by who may be asleep or otherwise engaged. All the machines I work on rely on PulseAudio on top of Advanced Linux Sound Architecture ( ALSA ) for their audio output. While there are many GUI based solutions for controlling PulseAudio output, I am generally connected to the machines via ssh without X forwarding enabled, making use of local GUI based tools at best inconvenient.

The solution I came up with, and which appears to work well for me so far is to use amixer command line tool to mute and unmute the Mater audio control using the following command. The first invocation silences the output, the second restores the output.

chuck@bakerstreet ~ $ amixer -D pulse sset Master toggle
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 77652 [118%] [off]
  Front Right: Playback 77652 [118%] [off]

chuck@bakerstreet ~ $ amixer -D pulse sset Master toggle
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 77652 [118%] [on]
  Front Right: Playback 77652 [118%] [on]
chuck@bakerstreet ~ $