You are not logged in.
I noticed that mute is not supported for softvol mixers in ALSA, so I made a simple script to emulate muting. The volume level is stored in volume.txt. I hope somebody finds this useful! This script changes the Master mixer by default.
mute.sh:
#!/bin/bash
var=$(amixer get Master | grep "Front Left:")
var=$(echo "$var" | sed -ne 's/^[^[]*\[\([^]]*\)\].*/\1/p')
if [ $var == "0%" ]
then
volume=`cat volume.txt`
amixer set 'Master' $volume
else
rm volume.txt
echo $var > volume.txt
amixer set 'Master' 0%
fi
You can bind it to mute hotkey for example with xbindkeys:
.xbindkeysrc:
#Mute
"/media/disk/programs/mute.sh"
m:0x0 + c:121
XF86AudioMute
(Change the file path accordingly)
Offline
mute.sh:
#!/bin/bash var=$(amixer get Master | grep "Front Left:") var=$(echo "$var" | sed -ne 's/^[^[]*\[\([^]]*\)\].*/\1/p') if [ $var == "0%" ] then volume=`cat volume.txt` amixer set 'Master' $volume else rm volume.txt echo $var > volume.txt amixer set 'Master' 0% fi
nice idea, but there is a simple one-liner for this:
amixer -c0 sset Master toggle
or perhaps:
amixer -c0 sset Headphone toggle
Offline
That doesn't work for me.
Offline
That doesn't work for me.
you probably just need to tweak the options slightly. the toggle command simply switches playback off and on for a given control, so you just need to find the control that works on your system.
you can list the controls like this:
$ amixer scontrols
Simple mixer control 'Master',0
Simple mixer control 'Headphone',0
Simple mixer control 'PCM',0
Simple mixer control 'Front',0
...
on my system, only 'Master' and 'Front' can be used to mute the sound - but every system will differ slightly.
maybe something like this will work for you:
amixer set Front toggle
Offline
"on my system, only 'Master' and 'Front' can be used to mute the sound"
Well, that's the main problem, my Master mixer cannot be muted, probably because it's a softvol plugin, not a normal hardware mixer. That's why I created this script.
Offline
my Master mixer cannot be muted, probably because it's a softvol plugin, not a normal hardware mixer.
somehow i managed to completely miss that - despite you putting it right there in the subject
Offline