KDE, Pulseaudio and Browsers – make the LADSPA equalizer the default sink

During these days of Covid-19, home-office and lock-downs browsers and other Internet streaming tools as VLC become important personal gates to the world. When streaming videos or songs a user, of course, wants to hear some sound. No problem with Linux - Alsa helped you already decades ago. But things used to become a bit complicated if you wanted to direct the output of multiple sound-sources through a global equalizer of your Linux desktop environment (in my case preferably KDE). An equalizer may help to compensate deficits of cheap speakers or hearing problems of elderly persons as me. Well, if you found a global desktop equalizer at all. With KDE, no chance - it always was a strange policy of the KDE-people to assume that an equalizer is none of their responsibilities. So, a standard Linux user depended on application specific equalizers - which at least many Linux sound and video players offered. But what about browsers?

This is, where "Pulseaudio" and the related "Ladspa" based equalizer really were of help to a common user. As a matter of fact, I have never been a real friend of "Pulseaudio" [PA]; you can find some critical posts regarding PA in this blog. However, I gladly admit that Pulseaudio and its control interfaces have become substantially better with the years. At some point in the past PA started to work reasonably well even with multi-channel soundcards. It is now also much better integrated with KDE's "Phonon" system than some years ago. Today, you can define e.g. a central volume control without destroying the relative volume ratios of different output channels of a sound card. And: We have a well integrated equalizer as a desktop-wide, global tool to improve the sound quality. So, why a post about it?

A problem with (automatically) changing streams and an assignment to a default sink

A problem with KDE and Pulseaudio in the past was the following: Only some applications (as e.g. "Clementine) " gave/give the user a chance to specify a sink of the sound environment to which the sound output of the application is transferred for further processing.

A sound sink is a kind of sound module which accepts a sound stream as input, processes it and may send an output to other processing modules or an amplifier. On KDE you may find some available sinks for your sound card or cards under "system-settings >> Multimedia". An important sink in our present context is the PA equalizer. See https://doc.qt.io/archives/qt-4.8/phonon-overview.html for the inclusion of media objects and sinks into a sound flow model ("graphs") for KDE.

However, a lot of applications as e.g. browsers do not offer any settings to modify the primary sound sink. Instead they address a "default sink" of the system. What the "default sink" was, was either non-transparent to the user, or some related settings within your KDE desktop were just ignored, or you had to dive deep into the unhandy Alsa and the PA-configuration options. This led to major inconveniences for normal users:

When a new sound stream was activated a default sound sink was chosen by many applications which often did not correspond to the preferred one - namely the equalizer.

This problem could only partially be overcome by using "pavucontrol", a PA-tool to control volume settings on channels and sinks in the system. "pavucontrol"actually allowed and allows the user to assign sinks to running applications and their sound streams. However, when the application switched from one stream to another - e.g. automatically in a media-player with a list of songs or on the web (youtube changing videos) - then the newly selected stream fell back to the default sink. Driving the user nuts ....

Setting of the default sink for the KDE desktop

I use Opensuse Leap 15.1/2 with KDE as my main working environment (besides Debian and Kali with Gnome 🙂 ). By chance I recently found something which did not work for me in previous installations. In KDE we have a specific sound system - "Phonon" - which allows the user to organize the priority of "devices" (sinks) for certain kinds of applications. In my case you see the settings for "music" applications:

You see that I have 2 sound cards available - but to make things simpler I deactivated one of them for this blog post. The first device listed is the PA's LADSPA equalizer:

It got the highest priority for music streams - more precisely for applications which follow the Qt/Phonon-API-rules when playing music streams. But, what about browsers (FF, Chromium, Opera, ...), what about applications designed for Gnome and GTK3? You often can direct them to use PA, but what does PA respect as a default sink in a KDE environment with Phonon?

Well the simple "trick" which I found working recently is to set the priorities for all audio in KDE's Phonon-settings:

Then we get the following PA-settings (install and start the pulseaudio-manager application "paman"):

This is what we need! And this setting is (now) respected by browsers and other applications that seek a default sink.

So: KDE, Pulseaudio and Phonon settings actually give a common KDE user the chance to direct all sound through the Ladspa equalizer as a default sink.

If your media-player offers its own equalizer you can of course combine both equalizers.

By the way: Common volume control

In the above picture on Phonon settings the sink "Simultaneous output to ..." directs multiple sound sources to one or multiple sound devices. As we direct all sound through the equalizer first, we give the "Simultaneous output ..."-device second priority.

We can use it for a common volume control in KDE's Kmix: If you right-click on the Kmix symbol or open it you get an option to choose the main output channel :

Now, this setting assigns the desktop's global volume control to this sink - which leaves all other volume settings, e.g. for the relative volumes of the sound-card channels, untouched:

You may find that this settings is transported to the sound control keys of a keyboard with a media control bar (e.g. on a Cherry keyboard).

Conclusion

With the help of KDE's system-settings and Pulseaudio we can direct the output of all audio applications through a desktop wide equalizer, which we define by Phonon settings as a default sink. This is simply done by giving PA's LADSPA equalizer the highest priority for all audio. You do not need to dive into PA configuration depths or the command line for changing PA's device and sink graphs for sound flows.
The "Simultaneous output ...." device (or sink) allows for a global volume control which respects other volume settings controlled e.g. via PA's "pavucontrol".

Skype 4.3 for Linux – no sound without pulseaudio – grrrr …

Sometimes, if something does not work on a Linux installation, one may find that frustrating. You hope for the best and try to find a solution - and in contrast to Windows I always had the impression that with Linux you have a chance to solve or circumvent your problems after some time. So, after the frustration about a Linux problem comes the interest in its details, then hope and after some work and information gathering even an improved knowledge about system configuration aspects and eventually some workaround ... At least most of the times ...

However, yesterday morning, when the cause of anger was a combination of Microsoft, Skype AND PulseAudio, I thought this was too much of an ordeal and there was not much room left for hope. Having last used Skype successfully on Aug, 1st, I needed to use it urgently again yesterday. But I had to learn: It does not work anymore despite the fact that I had not changed my system. No login to the Skype service possible. It took some time and tests to find out that, since some days ago, they only allow for connections from 4.3 Skype clients. After an update to the latest version I could log in to Skype again - however, sound did not work any more on my Linux system with - of course - plain ALSA. My blood pressure broke some records ....

It's no secret: I neither like Microsoft, nor their proprietary Skype nor PulseAudio as a sound system layer for Linux.

Although, if you once forget about the security and confidentiality risks associated with the use of Skype, there is one thing I have to admit:

Until the beginning of August Skype (4.2) worked quite well on Linux. Something I can not at all say about PulseAudio. And Skype is handy (although only available as a 32 bit solution), it works with good performance world wide - and (unfortunately) many of my customers use it. As I cannot convince all customers to change to a Linux desktop I adapted in the past to this situation and used Skype on a separate Linux system, which I boot on a laptop only for Skype sessions.

Up to now, my motives for that separate Linux were security related. Now, it seems there is one more reason to do so:

Skype 4.2 clients and below for Linux can no longer connect to the Skype service. [Why ???? - a really good question ... which makes me somewhat suspicious by the way ... ] So, you have to upgrade to Skype 4.3. However, Skype 4.3 ignores any ALSA sound configuration without PulseAudio. It took me some time to find that out. See:

http://www.skype.com/ene/download-skype/skype-for-linux/
and
https://support.skype.com/en/faq/FA10964/how-do-i-adjust-the-sound-settings-on-my-computer-and-in-skype-for-linux.
(Interestingly, in this last article Microsoft only refers to Ubuntu - maybe Skype only will work on Ubuntu, soon?.)

The requirement of PulseAudio - that's were the real frustration and anger for me begins. Microsoft forces me to use a special Linux sound system layer - which from my own experience generates more problems than it solves under many circumstances and on many systems.

Can a day start worse?

Ok, Microsoft does not force me to use Skype, after all. And, actually, I do not care so much to configure a separate bootable Linux version on my laptop which - for the sake of a working Skype - may use PulseAudio. As long as I do not have to use it otherwise and especially not on my desktops 🙂 . And the good thing with Opensuse is that (up to now !) PulseAudio can be deactivated relatively easily and system wide by YaST without having to reboot everything 🙂 . And even regarding the boot time for a special Linux installation as in my case - shutdown and boot times are pretty short on SSD driven laptops of the present generation. (Ironically this is partially due to "systemd" from just the same developer as PulseAudio.)

However, one can even understand that and why Microsoft wanted to use a common layer for an existing variety of possible underlying Linux sound architectures. So, the real dilemma is: Why do all major Linux distributions promote and configure a sound system layer and associated applications which after years of upgrades still are a pain in the ass for many Linux users ? One rather desperate person wrote this article last year:

http://www.beastwithin.org/blogs/wolfheadofselfrepair/2013/07/pulseaudio-insidious-linux-malware

Believe me, I understand this guy. I, personally, have had bad experiences with many soundcards and PulseAudio on Opensuse Linux for years. Crackling sound, distorted sound, sliders in "pavumeter" not all working as expected for multichannel cards, sound delay, sudden sound level increases to 100 %, some applications no longer working after PA upgrades, .... you name it. After some time with such experiences and one set of destroyed speakers, it became a habit for me to deactivate or deinstall PulseAudio on almost all of my Opensuse installations directly after the first system setup - which did a lot of good for my nerves, the soundcards and the speakers. Pure ALSA did and does a perfect job for me.

See also the small but interesting statistics on the following blog article:

http://www.techrepublic.com/blog/linux-and-open-source/pulseaudio-an-achilles-heel-that-needs-repair/

I agree with the author of that blog: Either, the Linux distributors

  • find an alternative or finance the work on an alternative
  • or the effort to change PulseAudio to something useful must be intensified.

Not only because of the Steam games engine ...

Until then:

  1. I have an additional reason to use a separate Linux installation for Skype.
  2. I am looking for Skype alternatives, usable both on Linux and Windows. Yesterday, I tried Jitsi/XMPP with a jabber account on a German server. Works well within the country, at least. What I like about Jitsi is the end to end encryption. I also like its simple interface and the fact that it is available both for Linux and Windows. However, when I tried to communicate with my wife, who presently is in Norway, the performance with sound and video transmission in parallel was very poor despite ADSL on both sides. But she was using a German server, too. We did not yet try with accounts on German and Norwegian servers. But this is stuff for another article.
  3. I see some positive aspects in Skype's present dependency on Pulseaudio, too. Maybe, other Linux users now start looking for Skype alternatives, too. And some geeks and Linux companies may find interest in developing such alternatives or supplying servers for it. E.g., Tox (see: https://tox.im/) is under development. Or, the pressure on the PulseAudio people may grow to eventually improve their baby to the level of reasonable usability.

So, eventually, there may be some hope even after yesterday's suffering ...