Friday 11 August 2017

Increasing the VOLUME in Linux

One annoying characteristic of Lubuntu in particular (and I suspect Linux in general) is that the playback volume is often too quiet, especially on laptops.


This problem is due to differences in audio recording levels, and is most noticeable when listening to audio via a web browser (e.g. watching a video).


Having put up with this for years, today is the day I feel I need to take some action.

Audio on Linux remains a mystery to me; alsa, pcm, pulse, OSS, Jack ...what's that all about?

I suspect its not really that complicated, its just a bit of a yawn to read about it. However, what I do know is that on Lubuntu both the on-screen volume control in the task bar, and the two function keys that control audio volume, do so by adjusting the alsa mixer master volume slider.

The alsa slider is scaled up to an arbitrary 100%. The range offered is normally fine for most audio sources, but sometimes the audio is too quiet on my laptop. As laptops often have pathetic little speakers, you need a Goldilocks setting; too low and you cannot hear it, too loud and the speakers rattle & distort.



Even running alsamixer from a terminal does not give you any extra boost options for playback volume.

Alsa + PulseAudio


From what I understand, alsa manages the audio hardware and provides an api (application programming interface) with commands such as amixer, alsamixer, arecord and aplay.

PulseAudio is described as a sound server, and here is a quote from Wikipedia which should make things clear:-

In a typical installation scenario under Linux, the user configures ALSA to use a virtual device provided by PulseAudio. Thus, applications using ALSA will output sound to PulseAudio, which then uses ALSA itself to access the real sound card.

Yep, clear as mud!

Anyway, the important thing is that PulseAudio allows you to bump the volume above 100%. So if PulseAudio is not installed on your Linux box, you probably need to consider installing it.

You can adjust the settings for PulseAudio via command line, or your installation may include a GUI Pulse Audio Volume Control. Initially I tried to increase the master volume from the command line like this:-

pactl -- set-sink-volume 0 12db

...which worked, but when I tried to reduce volume slightly using the task bar volume, alsa took over and dropped the volume back to 100%.

The solution was to find the audio control for the browser and leave the master volume set by alsa. So I ran:-

pactl list | more

...and noticed that "Chromium" was associated with Sink Input #2 (I'm not using Chromium, but my Brave browser obviously identifies itself as Chromium). So running the command:-

pactl set-sink-volume 2 200%

...seemed to control the browser volume, and this was not reset when I used the alsa master volume to control the volume from the laptop speakers. (note that the index "2" is dynamically set, so may change each time the browser is run).

Conclusion


So the answer is to run the application(s) that suffer with quiet audio tracks, and then either use commands in terminal or the PulseAudio GUI to set the applications audio level.

PulseAudio Volume Control

Setting the application volume in this way appears to be persistent, so this looks like a viable solution!

No comments:

Post a Comment