[pulseaudio-discuss] Binding volume changes to hotkeys.

Matthew Ellsworth matthew.ellsworth at gmail.com
Thu Jun 25 12:46:20 PDT 2009

I was recently asked to help set up a set of logitech usb speakers for
my brother who has recently made the move to Linux.  These speakers
have a known problem with noise under Linux, which I was able to fix
by adjusting the pulseaudio sink settings.  (many kudos to you all for
making that simple)

However, the volume control on the speakers behave as a usb keyboard,
i.e. they don't actually control the volume, they instead signal the
system that the volume knob is being turned.  Right now, the speakers
volume knob is adjusting the volume of the laptop's internal speakers,
leaving the usb speakers with no easy voulme control.  To me, the most
obvious solution is to simply re-bind the keys to a command that
adjusts the sink volume through pulseaudio.  However, in searching the
web for a command to do this, I not only failed to find any command to
do this, but found that pactrl, the only apparent command-line centric
pulseaudio command, uses it's OWN command line.  Not only that, but
the output of the program is in a rather computer-unfriendly format
preventing me from simply getting the volume and feeding it back into
pactrl.  It also uses a percentage format to display the volume, while
it uses pa_volume_t (an unsigned integer) for volume input.  So I cam
to the conclusion that pactrl was not the program I was looking for,
and therefore, the program I'm looking for does not exist.

Simply I'm looking for a program that would allow this:
$ pavol logi-usb up
$ pavol logi-usb +300
$ pavol logi-usb +3%
to increase the volume, and similar commands to decrease it on the
divice named logi-usb.  Alternatively:
$ pavol logi-usb get
vol: 20%
$ pavol logi-usb set 23
would be appropriate.

I'm willing to accept that this is not the most elegant way to do
this, (I think the fact that it fits with the "Unix Way" makes is even
more elegant but that's beside the point.) but I don't see anything
that would accomplish anything remotely similar to this within the
pulseaudio project.  Am I just missing some program, or do you have a
"superior" way to bind the volume controls to the volume of a
particular sink?  Is this something that is on the todo list? (In this
case, if you can point me towards the relevant documentation, I'll
take a crack at it.)

Matthew Ellsworth

More information about the pulseaudio-discuss mailing list