Beyond The Max Audio Volume

From TheBeard Science Project Wiki
Jump to: navigation, search

WARNING: This can damage your speakers! Follow my directions carefully!

Most Linux distros now use PulseAudio as the service that manages audio. PulseAudio allows arbitrary software amplification, and this may come in handy. If you're like me, you might have installed Linux on a laptop and found that the max audio volume was not as loud as it could be. It was certainly much louder when the laptop was running Windows. What gives? You most likely experienced this on the GNOME or MATE desktop environments (maybe others). The developers of these desktop environments were a little too conservative with how high their little audio tool was willing to go, at least using volume keys. It's kind of frustrating because the Sound Settings window has a volume slider that can go beyond 100%, but every time you want that extra volume you need to open the window and drag that slider up to the max. Annoying.

Ubuntu sound.png

Here's what you can do:

First, find out the name of your audio device. PulseAudio refers to an audio device as a "sink". A sink is a logical audio object that can send or receive audio I/O. It doesn't always need to be a physical device, such as in the case of a sink that receives audio data and outputs it to a file.

Run this command to list the available sinks:

pacmd list-sinks | grep name:

The sink you are looking for will likely have a name like:

alsa_output.pci-0000_00_1b.0.analog-stereo

Yours might be slightly different. This name corresponds to the audio device's location on the PCI bus. You can look at more information about PCI devices:

sudo lspci -vt

This will give you a hierarchical tree of PCI devices that looks like this:

-[0000:00]-+-00.0  Intel Corporation 2nd Generation Core Processor Family DRAM Controller
           +-02.0  Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller
           +-14.0  Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller
           +-16.0  Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1
           +-1a.0  Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2
           +-1b.0  Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller
           +-1c.0-[01]--
           +-1c.3-[02]----00.0  ASMedia Technology Inc. ASM1062 Serial ATA Controller
           +-1c.4-[03]----00.0  Broadcom Corporation NetLink BCM57781 Gigabit Ethernet PCIe
           +-1c.5-[04-05]----00.0-[05]--
           +-1c.7-[06]----00.0  ASMedia Technology Inc. ASM1042 SuperSpeed USB Host Controller
           +-1d.0  Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1
           +-1f.0  Intel Corporation Z77 Express Chipset LPC Controller
           +-1f.2  Intel Corporation 7 Series/C210 Series Chipset Family 6-port SATA Controller [AHCI mode]
           \-1f.3  Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller

Notice the first line where the root of the PCI bus hierarchy is [000:00].

Also notice the line +-1b.0 Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller that refers to the audio device.

These numbers correspond to the PulseAudio sink name alsa_output.pci-0000_00_1b.0.analog-stereo.

You can look up more information about that particular device:

sudo lspci -v -s 0000:00:1b.0

If you have multiple audio devices and can't determine which one is the correct device, you can also try to play an audio file through that particular device and see if it plays through your speakers.

pacmd play-file song.mp3 alsa_output.pci-0000_00_1b.0.analog-stereo

Once you have the correct device, you can run this command:
IMPORTANT: Start at a low percentage and work your way up. You could damage your speakers if you crank it up too high.

pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo 110%

Once you have increased your volume beyond 100%, you can bring it back down normally using the volume down button or a hotkey.

Now let's put this in a script and set it to a hotkey. I chose 150% volume for my laptop, but yours might be different.

sudo echo "pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo 150%" > /usr/bin/vol_150.sh
sudo chmod a+rx /usr/bin/vol_150.sh

Now you can set a hotkey, panel launcher, or anything else to run vol_150.sh and the volume will immediately increase to 150%. Since my laptop uses Fn+F11 and Fn+F12 as volume controls, I set Shift+Alt+F12 as the hotkey to go to 150% volume. I then just use Fn+F11 to drop the volume down to the desired level. Shift+Alt is often my go-to hotkey combo because it's comfortable to use and it rarely conflicts with other software.