Equalizer in Pulseaudio

I know of 2 options how to use equalizer
1) separate equalizer app
2) via loadable pulseaudio (PA) module

Ad 1)
outdated, seems like app is no longer supported and most of time not working due to various conflicts with PA or dbus

Ad 2)
The way I use. This way depends on loadable modules for PA. PA supports many loadable modules, for more info check link at the bottom

[12:54:25] root@localhost ~# ls -la /usr/lib64/pulse-12.2/modules/module-ladspa-sink.so
-rwxr-xr-x. 1 root root 56K 2018/07/16 19:41:42 /usr/lib64/pulse-12.2/modules/module-ladspa-sink.so
[12:54:18] root@localhost ~# rpm -qf /usr/lib64/pulse-12.2/modules/module-ladspa-sink.so
pulseaudio-12.2-1.fc29.x86_64

How to setup Pulseaudio :
all adjustments in config file /etc/pulse/default.pa
General syntax :
load-module module-ladspa-sink sink_name=ladspa_out sink_master=AUDIO_SINK plugin=mbeq_1197 label=mbeq control=10_VALUES_SEPARATED_BY_COMMAS

We need to customize 2 fields: AUDIO_SINK and 10_VALUES_SEPARATED_BY_COMMAS. It will be clarified later on
So now we will add 3 equalizers to config file /etc/pulse/default.pa

load-module module-ladspa-sink sink_name=ladspa_out sink_master=alsa_output.pci-0000_00_1f.3.analog-stereo plugin=mbeq_1197 label=mbeq control=4.8,4.8,3.5,2.5,0.0,-7.0,-14.0,-10.0,-10.0,-8.0,1.0,1.0,5.2,7.7,9.5
load-module module-ladspa-sink sink_name=ladspa_out2 sink_master=alsa_output.pci-0000_00_1f.3.analog-stereo plugin=mbeq_1197 label=mbeq control=7.8,5.8,4.0,2.5,0.0,0,0,0,0,0,1.0,1.0,5.2,7.7,9.5
load-module module-ladspa-sink sink_name=ladspa_out3 sink_master=alsa_output.pci-0000_00_1f.3.analog-stereo plugin=mbeq_1197 label=mbeq control=2,2,1.75,1.5,0.0,0,0,0,0,0,1.0,1.0,1.25,1.5,2

Modules can be configured in mentioned config file, so they will be loaded automatically on PA start OR they can be loaded using pactl:

pactl load-module module-ladspa-sink sink_name=ladspa_out sink_master=alsa_output.pci-0000_00_1f.3.analog-stereo plugin=mbeq_1197 label=mbeq control=4.8,4.8,3.5,2.5,0.0,-7.0,-14.0,-10.0,-10.0,-8.0,1.0,1
.0,5.2,7.7,9.5

When modules are loaded u can switch one of these 3 equalizations directly in Pavucontrol utility – on 1st tab Playback, for different apps u can choose audio source -1st one is usually you soundcard (unmodified sound) OR 3x LADSPA Plugin Multiband EQ.. (“equalized” sound).

 

how to find out AUDIO_SINK
[14:29:39] root@localhost ~# sudo -u pulse sh -c "pactl list sinks | grep Name"
Name: null
Name: alsa_output.pci-0000_00_1f.3.analog-stereo

 

how to find out 10_VALUES_SEPARATED_BY_COMMAS

this values were taken originally from Equalizer app at the time when it was yet working, however u can choose any values, try to stick in range +15..-15

 

More info about module module-ladspa-sink
at https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index47h3

Pulseaudio in system-wide mode

How it works and what is benefit of this setup
1) I can log on to GUI / KDE plasma as normal user eg. FRANTA, everything runs under FRANTA’s account – sound works
2) from command-line or from created .desktop shortcut, I execute some application, which will be running under different account from FRANTA, app examples : firefox, WINE – OUR AIM is to have properly working sound also for those apps


SO WHAT WE NEED

we need to configure pulseaudio to run in so called system-wide setup – thanks to this, pulseaudio (when properly configured) will be available for multiple selected/allowed users – see below (***)
pulseaudio itself will run under account “pulse”

So check is user “pulse” exists, if not then create it, user “pulse” must be member of group “audio”

[09:53:08] root@localhost ~# id pulse
uid=171(pulse) gid=171(pulse) groups=171(pulse),63(audio)

 

Config file /etc/pulse/daemon.conf :

system-instance = yes

Delete file /etc/pulse/system.pa and create symlink /etc/pulse/system.pa -> /etc/pulse/default.pa


Config file /etc/pulse/default.pa :

load-module module-native-protocol-unix auth-group-enable=true auth-group=pulse-access socket=/tmp/pulse-socket

Config file /etc/pulse/client.conf :

default-server = unix:/tmp/pulse-socket
(***) Allowed users

Every user that is intended to have properly working sound = access to pulseaudio, must be added to group “pulse-access” (if not existing create it)

[09:53:11] root@localhost ~# grep pulse-acc /etc/group
pulse-access:x:993:USER1,USER2,USER3

Warning, because pulseaudio now operates/runs under account “pulse”, some commands stop working under root account eg. pactl command for managing pulseaudio. Solution to bypass this limitation:

su -s /bin/bash pulse -
pactl list
OR
sudo -u pulse sh -c "pactl list"

 

Sound volume control (utility pavucontrol) works in KDE and under FRANTA account properly as FRANTA is member of “pulse-access” group and utility pavucontrol is capable of finding out how to connect to pulseaudio thanks to configuration in /etc/pulse/client (line default-server)

Sometimes it is also needed to setup the way how pulseaudio itself is started on boot via systemd, because in default pulseaudio is started for logged on user via some socket

So i created custome pulseaudio .service file – /etc/systemd/system/pulseaudio.service :

[Unit]
Description=Pulseaudio

[Service]
User=root
Type=forking
ExecStartPre=/bin/rm -f /root/.config/pulse/*
ExecStart=/bin/pulseaudio --realtime --daemonize
Restart=always

[Install]
WantedBy=graphical.target

 

systemctl enable /etc/systemd/system/pulseaudio.service
systemctl start /etc/systemd/system/pulseaudio.service
[14:30:55] root@localhost ~# ps -ef | grep pulse
pulse 1248 1 2 06:08 ? 00:13:53 /bin/pulseaudio --realtime --daemonize
pulse 1297 1248 0 06:08 ? 00:00:00 /usr/libexec/pulse/gconf-helper