Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 7
Linux HOWTO Kodi with Equalizer on LinuxMint 20.1
#1
Kodi with Equalizer on Ubuntu

Unfortunately dsp functionality has been dropped from Kodi a while back so the key reasons why i started to move away from the really great libreElec and to install LinuxMint 20.1 Xfce + Kodi was the lack of a working equalizer and automatic volume control on libreelec.

With the SSD's, the boot time of LinuxMint is really fast nowadays, so there is limited advantage to have a "reduced" linux compared to a full featured installation on a X86.

As I am ageing, my capability of hearing high frequencies declines, it becomes more difficult to understand what people say in movies. So an audio amplifier profile with high frequencies amplified while lowering low frequencies does really help. In addition to that, as I watch movies in night, I need a functionality that constantly adjusts the volume to keep it at the same level all the time. There is this trick in Kodi to amplify into saturation and lower the volume afterwards, however I have the impression that it reduces the audio quality. So the idea is to use the dsp functionality of the OS.     

It really takes some time to search the Internet for the possible solutions and do testing, in addition there are also some problems with the packages in question, so I decided to write what I did and what worked for me.

On Ubuntu I found 3 key solution for an audio equalizer:

pulseaudio-equalizer
    + easy to install
    + stable
    + low cpu consumption compared to others
    - does not provide automatic volume control functionality, so additional module would be required
    - I have not found a way to switch profiles from command line, yet. This would be required to switch profiles from within Kodi via a script or similar

PulseEffects
    + easy to install
    + stable
    + provides a lot of different dsp's including automatic volume control (autogain)
    - high cpu consumption (consumes about 30% on my cpu power), I think this is because it is based on gstreamer
    
any of the 3rd party LADSPA with PulseAudio - module-ladspa-sink
    - this option is dead from beginning because for whatever reason, the module is currently missing in the Ubuntu packages. And to compile and configure pulseaudio is really a pain.  
    + has lot of potential
    

For now, I decided for PulseEffects because of the included automatic volume control. In the future, if the issue with the missing module-ladspa-sink is sorted, I might switch to a combination of this and pulseaudio-equalizer, to reduce CPU consumption.

Install process
I use LinuxMint 20.1 Xfce as base system, Xfce because it consumes less resources.  

Some useful prerequisites if you want a Kodi box.

First, on a fresh installation of my media box, I enable ssh and install vim. I like vim but you can of course also use nano or something else.
Code:
sudo apt install openssh-server vim -y
I do any further settings from my work pc, where possible, via ssh or putty.

Get the latest...
Code:
sudo apt update
sudo apt upgrade

configure autologin, if forgotten in the install process, you need to replace USERID with your own
Code:
sudo vim /etc/lightdm/lightdm.conf

[Seat:*]
autologin-guest=false
autologin-user=USERID
autologin-user-timeout=0


Install Kodi
Code:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:team-xbmc/ppa
sudo apt-get update
sudo apt-get install kodi


Install PulseEffects from flatpak because the module "Equalizer" of PulseEffect is missing in the Ubuntu packages, why should it be different....
Code:
flatpak install com.github.wwmm.pulseeffects -y

Autostart PulseEffects as background service
Code:
vim ~/.config/autostart/PulseEffect.desktop

[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=PulseEffect
Comment=
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=pulseeffects com.github.wwmm.pulseeffects --gapplication-service
OnlyShowIn=XFCE;
RunHook=0
StartupNotify=false
Terminal=false
Hidden=false

and then reboot.

After reboot, start Kodi in window mode and play a movie to produce audio output.   

Start pavucontrol either from the Desktop volume control or e.g remote via ssh
Code:
export DISPLAY=:0 #in ssh if not done before
pavucontrol

Choose PulseEffects as default output device for KODI

In the "Playback" tab -> Kodi select PulseEffects(apps). It is only possible to see the Kodi line if Kodi is producing audio output- e.g. playing a movie. The same can be done for other applications, e.g. Firefox
Close window, it should keep those settings.


Configure PulseEffects, hopefully Kodi is still playing...

Start PulseEffects from Menu Start->Multimedia->PulseEffects or via ssh. It takes a bit of time until it comes up.
Code:
export DISPLAY=:0 #in ssh if not done before
flatpak run --branch=stable --arch=x86_64 --command=pulseeffects com.github.wwmm.pulseeffects

Enable Autogain and Equalizer and configure them as desired, close it, it will keep your settings.

Just for completeness, autostart Kodi
Code:
vim ~/.config/autostart/Kodi.desktop

[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Kodi
Comment=
Exec=kodi
OnlyShowIn=XFCE;
RunHook=0
StartupNotify=false
Terminal=false
Hidden=false

The issue with the volume control

One big problem with autogain is, it work against the Kodi volume control. So if I lower the volume within Kodi, autogain will automatically raise the volume as it thinks it is a quite section. So the Volume control needs to be moved out from Kodi.
Alternatively, autogain has to be disabled and the Kodi trick can be used.


I do not know whether Kodi has meanwhile the functionality to control the system volume instead of the Kodi internal volume. So one possible solution could be to write scripts that get executed when pressing the volume control. I also do not know whether this can be done easy within Kodi and I am not going into this as the luck plays for me...

I have a USB multimedia remote, similar to the Windows MCE, where nowadays, by default, the Multimedia keys are filtered by the OS and not sent to Kodi. To get the multimedia keys - except the volume control - into Kodi, I have done this.

There are still some keys missing and as I couldn't live without those, I now use inputlirc as described here , but I wrote me a little C program that forks the Volume control event back to the OS before it goes to inputlirc. I guess this is a topic for a future post or so.
 

Whats next
Open is still on how to switch between equalizer profiles from within Kodi, from a first check this should be possible via scripts. I might look into this if time allows.
Reply
#2
... continued
I did create a Kodi Addon to toggle between different PulseEffects presets.

So within PulseEffects, you can define a "Night" preset, a "Cinema" preset and so on. This addon will get the preset list from PulseEffects. 

This is a quick and dirty initial release, however for me it works. 

To use this, you need to have PulseEffects installed from Flatpak, the apt version does not work as the link is currently hard coded.
PulseEffects needs to run as a service

Within PulseEffects you need to define profiles, minimum two of course.

Within Kodi, you do not need to configure anything.

good luck. Any feedback is appreciated, also if you find this useful, I do not want to waste my time with useless stuff, of course. This is my first Kodi addon, so I apologize if something does not work as expected.

script.pulseeffects.toggle.zip
Reply
#3
I did update the addon.
      - now also Kodi 19 compatible
      - overcome some language issue in command line to improve the parsing of the pulseeffect responses
      - ignore gtk -error message some installs have with pulseeffects, that prevented the addon to work
Reply
#4
Kodi with pulseaudio-equalizer addon

Using pulseaudio-equalizer provides the advantage, that it is by far no so resource intensive like PulseEffects.

As mentioned above PulseEffects consumes on my ASRock J3455-ITX with Celeron processor @1500 MHz more than 30% CPU time while pulseaudio-equalizer only consumes arround 6%. This is a big plus. Disadvantage however is the missing automatic volume control. It is an equalizer only, no fancy DSP's.

Another disadvantage is, it is slightly more complex to write a Kodi control for it. However I managed to do it, some how.

So here is what I did, I take the system above as starting point, LinuxMit 20.1 Xfce.

If you have PulseEffects installed the way I describe above, disable the autostart of it with
Code:
rm vim ~/.config/autostart/PulseEffect.desktop

Kill the service or reboot.

Installation of pulseaudio-equalizer and python-dbus
Code:
sudo apt install pulseaudio-equalizer python-dbus

Enable the automatic module loading by editing /etc/pulse/default.pa, inserting the lines at the end of the file
Code:
sudo vim /etc/pulse/default.pa

...
load-module module-equalizer-sink
load-module module-dbus-protocol

In Xfce, it is not a good idea just to create a ~/.config/pulse/default.pa just containing those lines, it will load this file instead of the one in /etc/pulse. But you can copy the file from /etc/pulse to ~/.config/pulse/ and alter it there, if you like.

Then manually load the modules
Code:
pactl load-module module-equalizer-sink
pactl load-module module-dbus-protocol

Play a movie in Kodi in order to produce audio output from Kodi

Start pavucontrol either from the Desktop volume control or e.g remote via ssh
Code:
export DISPLAY=:0 #in ssh if not done before
pavucontrol

Choose the Equalizer as default output device for KODI

In the "Playback" tab -> Kodi select FFT-based-equalizer...(or so, I have different language).
It is only possible to see the Kodi line if Kodi is producing audio output- e.g. playing a movie. The same can be done for other applications, e.g. Firefox
Close window, it should keep those settings.

start the Equalizer control pannel
Code:
qpaeq

Then define profiles, minimum two.
Close the window.


Get my PulseEqualizerToggleAddon and install it in Kodi. With this addon you can switch between the different Equalizer profiles that have defined in qpaeq.


What's next... so, as it seams to be possible to write a full control for the equalizer as Kodi addon, I might do this, depends also a bit on my time and the interest of the community and capabilities of the Kodi GUI, I do not know this, yet. This has the potential to also run on headless X86 systems, I need to check this.
I still need to find a solution for the auto volume function.

enjoy
Reply
#5
Just in time for Kodi 19, the updated version for the PulseAudio-Equalizer.

PulseEqualizerToggleAddon_K19/releases/

I decided to keep the Kodi 18 version of the addon separate as there is a fundamental difference in the libraries used.
Reply
#6
Final,  a feature rich frontend for PulseAudio Equalizer.

Image

Kodi PulseEqualizer GUI Addon

PulseEqualizer GUI is an addon that provides configuration frontend for Kodi.

This includes:
Configuration of the equalizer with sliders
Manage equalizer profiles (add, remove and change)
Switch between equalizer profiles
Switch equalizer to specific output device and port
Hotkey support for each
Supports Kodi 18 and 19
Reply
#7
... continued

So now I reached the final step, to load the sc4 compressor ladspa module to get a constant audio volume. At the end, after I sorted my specific issue with the missing  pulse module, it was quite easy.

Install the ladspa filters with
Code:
sudo apt install swh-plugins
Documentation to those filters can be found here.


Then load the module:
Code:
pactl load-module module-ladspa-sink sink_name=Compressor plugin=sc4_1882 label=sc4 control=1,1.5,401,-20,20,5,15

with this control settings, the output volume of the compressor is at about 100%, regardless of the input coming from Kodi.

The end of my /etc/pulse/default.pa looks like this in order to autoload the modules.
Code:
...
load-module module-dbus-protocol
load-module module-equalizer-sink sink_name=Equalizer_1
load-module module-ladspa-sink sink_master=Equalizer_1 sink_name=Compressor plugin=sc4_1882 label=sc4 control=1,1.5,401,-20,20,5,15

Then the audio chain need to be configured.

My chain is Kodi -> SC4 Compressor -> PulseEqualizer -> SoundCard

In order to achieve this, play a video in Kodi. In Kodi->System->Audio select as Audo output device LADSPAD Plugin SC4...
Then launch pavucontrol.
On the play tap, for the LADSPA Stream in select FFT-based-Equalizer....

If you don't see the streams, you might need to change the "show" settings at the bottom of the pavucontol window.

Also update the PulseEqualizerGui to version 1.0.1 to avoid a crash in context of the loaded module-ladspa-sink.

Done. I was listening to music for a couple of hours and playing movies, everything is very stable, I did also not hear any glitches, overall a real significant improvement. ... get the best out of the poor speakers. Also on my BOSE headset, everything sounds very good.
Reply
#8
To make filter chain setup more easy, I did add Filter Chain Support to PulseEqualizerGui 1.0.2. There is no need any more to connect the filter manually via pavucontrol. The filter chain gets connected to each other at the moment Kodi starts to play something to the first element in the chain.
Reply
#9
Hello, very much like your eqalizer under linux like. I often use KODI to play music and I would like to try it but I can only use it in KODI via CoreELEC. Couldn't your equalizer be modified as an addon for KODI in CoreELEC? Thank you very much for the information and have a nice day.
Reply
#10
(2021-03-01, 17:56)ac3ac3 Wrote: Hello, very much like your eqalizer under linux like. I often use KODI to play music and I would like to try it but I can only use it in KODI via CoreELEC. Couldn't your equalizer be modified as an addon for KODI in CoreELEC? Thank you very much for the information and have a nice day.

Thanks for your interest. Currently the down size linux installations like libreElec, coreElect etc. do not have the required packages installed and it might be a hazzel to install them. Maybe later the owners of such distribution might include this into their builds, guess we are not there yet. For me currently, priority is to get running on a raspi. First test where very successful. I will also change it to make set-up much more easy, this is required for the raspi - Kodi which mainly outputs through alsa.
Reply
#11
(2021-03-01, 18:06)wastis Wrote:
(2021-03-01, 17:56)ac3ac3 Wrote: Hello, very much like your eqalizer under linux like. I often use KODI to play music and I would like to try it but I can only use it in KODI via CoreELEC. Couldn't your equalizer be modified as an addon for KODI in CoreELEC? Thank you very much for the information and have a nice day.

Thanks for your interest. Currently the down size linux installations like libreElec, coreElect etc. do not have the required packages installed and it might be a hazzel to install them. Maybe later the owners of such distribution might include this into their builds, guess we are not there yet. For me currently, priority is to get running on a raspi. First test where very successful. I will also change it to make set-up much more easy, this is required for the raspi - Kodi which mainly outputs through alsa.

Hi there. Also looking for a solution like this. How is it going with raspi? I currently use an S905 Minix Neo U1 with coreelec, but if this is not going to work i would invest in a raspi just for being able to EQ it's output. Would it work with my setup, where the coreelec device (to be raspi) is today connected to the receiver via toslink optiacal cable, or do we need to use analog audio output? I assume it could work when the box doesn't forward the audio stream via SPDIF, but decodes it and outputs a PCM stream...

Thanks for your answer!
Reply
#12
(2021-09-10, 22:59)eckertb Wrote:
(2021-03-01, 18:06)wastis Wrote:
(2021-03-01, 17:56)ac3ac3 Wrote: Hello, very much like your eqalizer under linux like. I often use KODI to play music and I would like to try it but I can only use it in KODI via CoreELEC. Couldn't your equalizer be modified as an addon for KODI in CoreELEC? Thank you very much for the information and have a nice day.

Thanks for your interest. Currently the down size linux installations like libreElec, coreElect etc. do not have the required packages installed and it might be a hazzel to install them. Maybe later the owners of such distribution might include this into their builds, guess we are not there yet. For me currently, priority is to get running on a raspi. First test where very successful. I will also change it to make set-up much more easy, this is required for the raspi - Kodi which mainly outputs through alsa.

Hi there. Also looking for a solution like this. How is it going with raspi? I currently use an S905 Minix Neo U1 with coreelec, but if this is not going to work i would invest in a raspi just for being able to EQ it's output. Would it work with my setup, where the coreelec device (to be raspi) is today connected to the receiver via toslink optiacal cable, or do we need to use analog audio output? I assume it could work when the box doesn't forward the audio stream via SPDIF, but decodes it and outputs a PCM stream...

Thanks for your answer!

I did get it running under raspi 3, however consumes lots of cpu. Due to very low interest of the community, I stopped developing standard packages.
Reply
#13
(2021-09-11, 11:25)wastis Wrote: [quote="eckertb" pid='3059574' dateline='1631307596']
[quote="wastis" pid='3018862' dateline='1614614796']

I did get it running under raspi 3, however consumes lots of cpu. Due to very low interest of the community, I stopped developing standard packages.

What about on the Pi4? 4GB of RAM should help…
This is a Feature I would LOVE to be able to use
Reply
#14
Thanks for the gui plugin, i's working
Reply
#15
I did set up a headless Debian 10 with Kodi 19.1 and with the pulse-audio equalizer on an i386, which is much nicer on a stand alone box. The difficult part was to get the d-bus session without a X11 session running. The d-bus is required to control pulse-audio and a prerequisite to get the pulse audio GUI addon above to work.

So this does the trick on Debian:

Define an auto start script (/etc/rc.local), which calls another script as user wasti.
 
Code:
#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          kodi
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO
sudo -u wasti run_session.sh &
exit 0

The run_session.sh script launches the dbus session and ensures everything in run_kodi.sh is within this dbus-session
 
Code:
#!/bin/sh -e
exec dbus-run-session -- run_kodi.sh

run_kodi.sh finally start pulse audio and kodi
 
Code:
#!/bin/sh -e
/usr/bin/pulseaudio -D
/usr/bin/kodi

This is a quick and dirty solution with some drawbacks, however it is working. With some modification, the process could also be launched by the systemd and thus work on ubuntu and other headless systems.
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 7

Logout Mark Read Team Forum Stats Members Help
HOWTO Kodi with Equalizer on LinuxMint 20.10