alsamixer: lock levels

Nils Kassube kassube at
Fri Apr 12 05:30:44 UTC 2013

Istimsak Abdulbasir wrote:
> >I don't think there is a way to actually limit the mixer level. But
> >you could run a script in the background to check the mixer level.
> >If the level is higher than a specified value, it would reduce it to
> >the max. allowed level. The script would use amixer which is useful
> >for scripts while alsamixer is made for interactive operation. If
> >you need help writing the script, please provide the output of the
> >command
> >
> >amixer controls
> >
> >(only from one machine for a start).
> >
> >Anyway, I'm not so sure it is useful to try to solve social problems
> >with technical means.
> I would like to see that type of script. Would be amazing if that were
> possible.

Something like this:

val=$(amixer cget name='Master Playback Volume'|grep ': values=')
test "$val" -gt 50 && amixer cset name='Master Playback Volume' 50

Of course this is only for my desktop machine. To adapt it to your 
machine you should check the output of the command

amixer contents

(not "amixer controls" like I wrote in my previous mail) to find out the 
actual name of the volume you want to control. And you should change the 
value 50 (both places) to the value you want to use as the limit for 
your machine.


More information about the ubuntu-users mailing list