March 26, 2013

Install Pulseaudio With Built-In System-Wide Equalizer In Ubuntu

About two years ago we had an article about a system-wide Pulseaudio equalizer. This tool is still used today but it's no longer developed and it doesn't work properly for everyone, so many users have been looking for alternatives.

Well, I'm not sure if you're aware of this, but Pulseaudio has, for a while, its own built-in system-wide equalizer. However, the Pulseaudio packages available in the official Ubuntu repositories are not build with equalizer support. In Ubuntu 13.04, Pulseaudio is finally build with equalizer support but the actual equalizer is missing from the package for some reason, even though it's available in the source.

So, to make things easier for you, I've create a PPA for Ubuntu 13.04, 12.10 and 12.04 with Pulseaudio built with equalizer support and with the actual equalizer enabled.


Since I've used the packages from the official Ubuntu repositories for this (Pulseaudio 2.1 for Ubuntu 12.10, 1.1 for Ubuntu 12.04, etc.) and I didn't even remove the patch that disables loading dbus (which is required for the equalizer to run, but we can manually enable this, I'll tell you about it later on), using this PPA should be safe and shouldn't break or even change anything for that matter. Further more, without manually enabling the equalizer, you won't even know its there, so if you don't like it, you don't even have to purge the PPA. You can, however, purge it easily if you want.

I expect the equalizer to work better in Ubuntu 13.04 (since Raring has Pulseaudio 3.0 while Quantal has 2.1 and Precise 1.1 and thus, older equalizer, etc.) and indeed it has worked great in my test under Ubuntu 13.04 but I've also performed a quick test in Ubuntu 12.10 and 12.04 and I didn't notice any issues. But this also depends on the hardware so only you can tell if it works ok for you or not. Also, depending on your hardware, in some rare cases this can break your sound, but you can simply undo step 5 and everything should be back to normal.

It's also worth mentioning that the equalizer doesn't come with any presets, so it's up to you to set the optimal values which might not be something easy to do. If you don't like this, try the old PulseaAudio System-Wide Equalizer which comes with presets.

Here's how the equalizer looks like:


If you resize the window horizontally, you'll notice that more bands show up so using it, you have a lot more control than with the old Pulseaudio Equalizer:





Install Pulseaudio with system-wide equalizer support in Ubuntu


Ubuntu 13.04 Raring Ringtail users don't have to add the PPA - you can simply download qpaeq (the equalizer) and place it in you path, like /usr/local/bin for example, and make it executable. If you do this, skip step 1 below. But you can add the PPA below since it's safe and you'll get the equalizer automatically.


1. To add the PPA (available for Ubuntu 13.04, 12.10 and 12.04), use the following commands:
sudo add-apt-repository ppa:webupd8team/pulseaudio-eq
sudo apt-get update
Then, launch the Software Updater and upgrade the packages (or run "sudo apt-get dist-upgrade"). Make sure all Pulseaudio packages have been upgraded successfully!


2. To be able to use the equalizer, you'll need to install some extra dependencies:
sudo apt-get install python-dbus python-qt4 python-qt4-dbus pulseaudio-utils

3. Now, let's restart Pulseaudio. Open a terminal and copy/paste the following commands:
pulseaudio -k
pulseaudio &

4. Everything is ready now, but the equalizer needs two modules to be loaded to work, so open a terminal and copy/paste these two commands:
pactl load-module module-equalizer-sink
pactl load-module module-dbus-protocol

Now you can launch the equalizer. It doesn't come with a desktop file so either press ALT + F2 or open a terminal and type:
qpaeq
The equalizer should now start.

You can now play some music / video / etc. and try the equalizer. To see if it works, you can set the preamp (first slider on the left) to maximum or minimum. If the sound doesn't go up or down, open the sound settings and under Output, select "FFT based equalizer on Built-in...":


Some applications will only work with this while others will also work without changing this (I'm not yet sure exactly how this works, please leave a comment if you know more about this).


5. The modules we've loaded under step 4 aren't automatically loaded on system start. So if you want to be able to use the equalizer after a restart without having to run those two commands, you'll have to add those modules either to ~/.pulse/ for your user or /etc/pulse/default.pa for all users. Below, I'm going to add them to /etc/pulse/default.pa and for this, you'll need to open the file as root with a text editor:
gksu gedit /etc/pulse/default.pa

And at the bottom of the file, add this:
### Load the integrated pulseaudio equalizer and dbus modules
load-module module-equalizer-sink
load-module module-dbus-protocol
Then save the file and you're done.


Reverting the changes


If you want to revert the changes, you can simply just remove the lines you've added in step 5 from the /etc/pulse/default.pa file:
gksu gedit /etc/pulse/default.pa
And remove these lines:
### Load the integrated pulseaudio equalizer and dbus modules
load-module module-equalizer-sink
load-module module-dbus-protocol
Then save the file, restart the system and everything should be like before.

If for some reason you also want to purge the PPA (although this shouldn't be required), install PPA Purge with multi-arch support, then purge the PPA using the following command:
sudo ppa-purge ppa:webupd8team/pulseaudio-eq


Also see: https://wiki.archlinux.org/index.php/PulseAudio/Examples (some bits from the Arch wiki were used in this article).

Source: http://www.webupd8.org/2013/03/install-pulseaudio-with-built-in-system.html