Control Pulseaudio from the Command Line – Ruby Script

technology.png
For reasons far too tedious to go into here1 I needed to control PulseAudio’s volume (and toggle mute) from the command line. I eventually found a Ruby script – but it didn’t completely work. I tweaked it a bit, forked it on github, and now present it for your pleasure.

The main reason you’d want to use this over the various bash scripts floating around is this: It works on all your audio sinks, not just one of them. Something you never think about… until you have to (like I did this week).

I’m really quite thrilled – this is my first time figuring out a Ruby script and my first time using github for my own stuff. Huzzah!

Hope this helps someone!

1 I needed to control through pulseaudio instead of ALSA, largely because of the new USB speakers I have. I want the internal audio (for headphones, etc) to keep working too, and I use openbox, so graphical versions are out of the question and constantly switching sinks in scripts sucks. Hence this.