You are not logged in.

#1 2008-06-23 16:53:13

Atticus
Member
Registered: 2007-06-14
Posts: 52

Setting volume automatically in shell script

hi there, I'm trying to create a shell script that unmutes and sets the volume for a sound card's mixer controls, using amixer.  It will pretty much always be run in Arch Linux using alsautils.  This script will be used on computers where I won't necessarily know what exact controls the user will have in their sound card, so running a command like 'amixer set Master unmute 75%' won't really work, but they may not have a Master, or it might have a slightly different name.  So really it seems like the only way to get this done is to parse through the output of 'amixer scontrols' and try to find all controls that have either a pvolume or cvolume capability.  Is this the best way of doing this, or is there some simpler way?  If so, I was hoping people could give me a headstart on the sed/awk pattern(s) I'll need for this.

Thanks all

Offline

#2 2008-06-23 18:55:28

ibendiben
Member
Registered: 2007-10-10
Posts: 519

Re: Setting volume automatically in shell script

Not sure what you're asking but:

amixer scontrols | sed "s#^.*[']\(.*\)['].*#\1#"

returns a list of all available controls... or did you only want to find a way to test whether a control is c/p-vulume capable. Is that one always on top  maybe?

My suggestion would be to try aumix... it's in comunity as "aumix-gtk"...
then you can simply use:

#voldown
aumix -v -10
#volup
aumix -v +10

If this doesn't help you, could you be more specific?

Offline

#3 2008-06-25 12:53:25

Atticus
Member
Registered: 2007-06-14
Posts: 52

Re: Setting volume automatically in shell script

Thanks, aumix is just what I was looking for!

Offline

Board footer

Powered by FluxBB