ces

Control the audio volume and test it via CLI on Gentoo

This is a just a rant/quick note to myself since Google is now useless for these kinds of searches. If you find it useful, you're welcome.

I use the Gentoo LiveCD for kiosk mode on my laptop. Since I don't use the regular KDE/Plasma GUI, but run my own WM, this is just documentation for my setup so I know what things to fix the next time things change again.

The first thing you will need is to get pipewire installed and running. As per the man page, "PipeWire is a service that facilitates sharing of multimedia content between devices and applications."

Rant: It falls in the long line of random stuff that keeps getting tweaked in every other newer version of a distro so that the older crap no longer works and I have to do this rediscovery process all over again.

Anyway, now that is off my chest, you run it as:

pipewire &

The next thing that is needed is to then run:

wireplumber &

With all of this plumbing in place, you can now run:

wpctl status

If this fails with the message: Could not connect to PipeWire see above and/or debug why pipewire/wireplumber died.

When things work, wpctl status should show a tree like structure in your terminal with sub trees titled Audio/Video etc.

The part that we are interested in is Audio -> Sinks There should be a starred line such as this:

 │  *   50. Built-in Audio Analog Stereo        [vol: 0.40]

The specific part we are interested in here is the number after the *, and in this case, it happens to be 50.

We use the 50 as an "identifier" to set/get the audio volume like this:

wpctl set-volume 50 0.3

That should lower the volume from the previously set value 0.4 to 0.3

You could reduce it further by running a followup command like this:

wpctl set-volume 50 0.2

Finally, you can run a test to see if the volume is just right by either playing a tone or a voice. This plays a tone:

speaker-test -t sine -f 440 -l 1

To test voice and check mono vs multiple speakers use this:

speaker-test -c 2 -t wav -l 1
← Previous
Solarpunk Webring
Next →