I'm frequently changing the audio setup of my laptop (sometimes using the built-in jack port, sometimes nothing at all, sometimes using USB headphones, sometimes using the jack port in the dock of my laptop). I'd like to have keyboard shortcuts to lower or increase volume for all outputs at once, so it works no matter which audio output is currently active. What's the easiest way to achieve this? I also see that in pavucontrol, I can go above 100%, which is sometimes practical, so if the command was also able to do this, that'd be great.

I'm running Debian Testing, kernel 4.9.0-3-amd64, and pulseaudio 10.0.


You need a script to do this. There are scripts like this that control the default sink, but I haven't seen one that controls all sinks.

You can get a list of all sinks with pacmd list-sinks, and set the volume with pacmd set-sink-volume, so you need to do something like

for SINK in `pacmd list-sinks | grep 'index:' | cut -b12-`
  pactl set-sink-volume $SINK $VOLUME

where $VOLUME can be absolute (150%) or relative (+5%, -5%), and possibly other formats, too.

Most window managers can be configured to launch scripts or programs, complete with arguments, when you press keys. That's the best method, but if your WM doesn't, there are tools like xbindkeys. So you can customize in any way you want.

Note that Pulseaudio will start using hardware mixers if the sink volume goes over 100%, and that can distort the sound.

Also note that Pulseaudio allows to set the volume for each application ("audio stream") with pamcd set-sink-input-volume. You can list them with pacmd list-sink-inputs and set them in a similar way.

That allows you have the sink volumes at a fixed level so they are about equal, without using hardware mixers, and when you switch sinks, it will automatically have the "right" volume. That's the setup I prefer.

|improve this answer|||||
  • 2
    Using percentages as $VOLUME returns "Failed to parse volume" errors. Changing the inner line to pactl set-sink-volume $SINK $VOLUME works. Thanks! =) – Ted Jun 29 '17 at 9:18
  • 1
    Right, now that you mention it I remember I ran into the same thing ... I've never understood why there are both pactl and pacmd. – dirkt Jun 29 '17 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.