Muting audio with mixer.

How do I mute volume in FreeBSD laptop running 12-CURRENT?

I tried running mixer vol mute, which sets the volume to 0. However there is no way to get back the old volume level, something line mixer vol unmute or even mixer vol mute toggle.

I run a minimal window setup around Xmonad, I came across the above issue because I wanted to bind the mute key XF86AudioMute, and couldn't find a simple option.
 
  • Thanks
Reactions: mro
I have the same question in FreeBSD 12.1.

I search a way to toggle the sound, but toggle let the volume to 0:0 in the second call.

Here the behaviors:

Bash:
mixer vol
> Mixer vol      is currently set to  50:50

mixer vol toggle
> Setting the mixer vol from 50:50 to 0:0.

mixer vol toggle
> Setting the mixer vol from 0:0 to 0:0.

man mixer | grep toggle
>           ^rec  toggles rdev of possible recording devices

How can we handle this ?
(I actually create a temp file with the volume value and delete it, but that sound very bad )
 
(I actually create a temp file with the volume value and delete it, but that sound very bad )
Why sounds that bad? You want to save something, a file is a perfect thing to do such things. It is the same as a any other configuration file. And it's simple… Here's my example, can be saved f.e. as ~/bin/togglevol.sh:
Code:
#!/bin/sh

if [ -f ~/.togglevol ]
then
        mixer `cat ~/.togglevol`
        rm ~/.togglevol
else
        mixer -s vol > ~/.togglevol
        mixer vol 0:0
fi

I'm using entries in my start menu for mixer settings, but: I don't want to toggle, but want to return to my default settings. So there's one entry with my default listen settings, and one with my default settings for recordings.
 
Why sounds that bad?
If there is a toggle option, recreate the functionality sound bad.
But as you say, if there is no toggle option (and I did not see a toggle in man page) I will let the file do the job.
I have the same script (except file location is ~/.tmp/mixervol and I use && and || instead of if/then/else).
If we are two with the same needs, maybe we are a lot ?
 
Back
Top