Linux HOWTO Kodi with Equalizer on LinuxMint 20.1
#16
(2021-09-12, 09:40)heysoundude Wrote: What about on the Pi4? 4GB of RAM should help…
This is a Feature I would LOVE to be able to use

 Ok, I did a closer look to it, still using Pi3, the performance actually is not the problem, it consumes about 25% of one core, so 6% overall.

The problem currently is that Kodi somehow is set to ALSA output only, so far I did not manage to output the sound directly to pulseaudio (without ALSA in-between).

There is this ALSA plugin pulseaudio, which is currently use for BT devices. I did hijack this to route the audio from Kodi via ALSA to the pulse equalizer and this works perfect with the annoying drawback, that the audio latency naturally caused by the equalizer is not reported back to Kodi and thus Audio and Video are out of sync of about 350ms.

Currently I have no Idea how to fix this other than changing Kodi source, a route I currently don't want to go.

The changes to the Kodi PulseEqualizer GUI Addon are minor and only required if ALSA would remain the main source for the equalizer.

Any ideas are welcome, I did use latests Raspberry Pi OS Lite version for testing with default Kodi 18.7.

EDIT: OK, I go this sorted. Update on Addon package will follow.
Reply
#17
Hi all,

I have published a new release v1.0.3 on git, which will also run on raspberry PI 3 OS Lite and headless systems.

Please see README.md for the specific startup on raspberry and headless systems.

PulseEqualizerGui v.1.0.3
Reply
#18
And an other release with major changes in the software design and many new features and improvements. 
  • added latency-offset slider
  • possibility to switch equalizer on/off
  • change output selection method
  • added system volume control
  • automatic module loading, simplified pulseaudio configuration
  • save settings per selected device (volume, profile and latency)
  • automatic bluetooth device switching
  • skip filter if no playback (no latency on GUI sounds)

PulseEqualizerGui v2.0.0
Reply
#19
Hi,
thank you for providing this plugin!
I have installed the plugin on my Jetson Nano running Ubuntu 18.04 and Kodi 19.3 and I am unable to get it running.

Pulseaudio-equalizer is installed, and the plugin seems to load normally. I am able to select the output and the latency, but nothing shows when I click on Equalizer, or the profile related settings.

The kodi.log shows:
Code:

2021-11-30 17:50:16.731 T:8005     INFO <general>: equalizer: start addon
2021-11-30 17:50:16.731 T:8005     INFO <general>: equalizer: addon has been selected and is first instance
2021-11-30 17:50:24.848 T:8015    ERROR <general>: eq: in: /home/michael/.kodi/addons/script.pulseequalizer.gui/resources/lib/pulseinterface/pacentral.py: 90
2021-11-30 17:50:24.848 T:8015    ERROR <general>: eq: in: /home/michael/.kodi/addons/script.pulseequalizer.gui/resources/lib/pulseinterface/eqcontrol.py: 60
2021-11-30 17:50:24.848 T:8015    ERROR <general>: eq: in: /home/michael/.kodi/addons/script.pulseequalizer.gui/resources/lib/pulseinterface/eqcontrol.py: 85
2021-11-30 17:50:24.848 T:8015    ERROR <general>: eq: in: /home/michael/.kodi/addons/script.pulseequalizer.gui/resources/lib/pulseinterface/eqcontrol.py: 46
2021-11-30 17:50:24.849 T:8005    ERROR <general>: eq: in: /home/michael/.kodi/addons/script.pulseequalizer.gui/addon.py: 48
2021-11-30 17:50:24.849 T:8005    ERROR <general>: eq: in: /home/michael/.kodi/addons/script.pulseequalizer.gui/resources/lib/menus.py: 42
2021-11-30 17:50:24.849 T:8005    ERROR <general>: eq: in: /home/michael/.kodi/addons/script.pulseequalizer.gui/resources/lib/menus.py: 52
2021-11-30 17:50:24.849 T:8005    ERROR <general>: eq: in: /home/michael/.kodi/addons/script.pulseequalizer.gui/resources/lib/menus.py: 206
2021-11-30 17:50:24.849 T:8005    ERROR <general>: eq: in: /home/michael/.kodi/addons/script.pulseequalizer.gui/resources/lib/helper/socketcom.py: 97
2021-11-30 17:50:24.849 T:8005     INFO <general>: CPythonInvoker(18, /home/michael/.kodi/addons/script.pulseequalizer.gui/addon.py): script successfully run


The Github-page lists only 'pulseaudio-equalizer' as a requirement, this forum shows a lot of additional requirements - but these might be related to older plugin-versions only.

Maybe you can give me some hints on what could be missing or wrong.

Thank you
Reply
#20
Hi @MicTie 
I have not tested it on ubuntu 18 however this looks like an user session problem, so dbus is not running or not accessible from Kodi. This indicates an startup script problem.

Is this a headless system, so without a desktop?

One test could be: - exit Kodi(not shutdown) - login to the machine via ssh as user and check if pulse audio is running
 
Code:
ps -ef | grep pulseaudio

user         457     427  1 14:18 ?        00:00:01 /usr/bin/pulseaudio --verbose --daemonize=no
user         591     586  0 14:20 pts/0    00:00:00 grep pulseaudio

if you have the same output, then start Kodi from here
 
Code:
kodi &

and then check if it is working now.

2. In Kodi, enable debug logging (Kodi- settings -> system -> expert modus -> logging -> enable debug logging
try to run equalizer

copy .kodi/temp/kodi.log to https://paste.kodi.tv/ and provide me with the link, so I can check whether this is an addon bug.
Reply
#21
Hi @wastis ,
this was fast - thanks!

My system is a desktop, using my TV as display, although most of the time I connect headless via SSH.

'pulsaudio' is started, but not 'demonized'

Code:

[email protected]:~/.kodi/temp$ ps -ef | grep pulseaudio
michael   6629     1  1 17:47 ?        00:03:01 /usr/bin/pulseaudio --start --log-target=syslog
michael  14183  8173  0 21:40 pts/0    00:00:00 grep --color=auto pulseaudio

Also dbus is installed and running:

Code:

[email protected]:~/.kodi/temp$ ps -ef | grep dbus
message+  3941     1  0 17:47 ?        00:00:06 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
michael   6114  6010  0 17:47 ?        00:00:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
michael   6458  6453  0 17:47 ?        00:00:00 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3
michael  21103  8173  0 22:06 pts/0    00:00:00 grep --color=auto dbus

Here the link to my kodi.log
Reply
#22
Hi @MicTie 

yes, it is a session / pulseaudio startup problem, indicated here.

 
Code:
2021-11-30 21:47:06.358 T:20857   ERROR <general>: eq: PulseDBusError: ('org.freedesktop.DBus.Error.ServiceUnknown\nThe name org.PulseAudio1 was not provided by any .service files\ndetail: python3 on connect',)

So pulseaudio does not publish the service to the user who did launch Kodi.

who is the kodi user, so the user who fires kodi up, is it also michael?
 
Code:
ps -ef | grep kodi
user         613     608  8 14:23 ?        00:04:49 /usr/lib/x86_64-linux-gnu/kodi/kodi.bin

have you been able to start kodi from a ssh session?
Reply
#23
Hi @MicTie

I thought about this again. As a work around, you could try to connect directly to the dbus socket, if it exists. To do so do the following.

figure out your userid
 
Code:
cat /etc/passwd | grep user

user:x:1000:1000:user,,,:/home/user:/bin/bash

the first 1000 is the userid.

check if socket exists
 
Code:
ls -l /run/user/1000/pulse

srwxrwxrwx 1 user user 0 30. Nov 17:54 dbus-socket
srw-rw-rw- 1 user user 0 30. Nov 17:54 native
-rw------- 1 user user 4 30. Nov 17:54 pid
 
I have the dbus-socket when dbus module is loaded (Kodi is running), if you don't have it, then there is definitely a problem with pulseaudio startup

set the environment variable in your startup script
 
Code:
PULSE_DBUS_SERVER=unix:path=/run/user/1000/pulse/dbus-socket
my startup script looks like this, then
cat /etc/systemd/system/kodi.service
 
Code:
[Unit]
 Description=kodi startup service

[Service]
 Type=simple
 ExecStart=su -c 'PULSE_DBUS_SERVER=unix:path=/run/user/1000/pulse/dbus-socket /usr/bin/kodi' user 2>&1 &
 TimeoutSec=0
 StandardOutput=tty
 RemainAfterExit=yes
 SysVStartPriority=99

[Install]
 WantedBy=multi-user.target
reboot and with a bit of luck this works.

Further you could either enable logging for pulseaudio -vv in your startup script or stop the pulseaudio service and start pulseaudio in a ssh session and look at the beginning of the log.
 
Code:
systemctl --user stop pulseaudio.service
systemctl --user stop pulseaudio.socket

pulseaudio -v

I: [pulseaudio] main.c: This is PulseAudio 14.2
I: [pulseaudio] main.c: Page size is 4096 bytes
I: [pulseaudio] main.c: Machine ID is 0cd85806162b4ffcae2d3779dd18c549.
I: [pulseaudio] main.c: Session ID is 2.
I: [pulseaudio] main.c: Using runtime directory /run/user/1000/pulse.
I: [pulseaudio] main.c: Using state directory /home/user/.config/pulse.
I: [pulseaudio] main.c: Using modules directory /usr/lib/pulse-14.2/modules.
I: [pulseaudio] main.c: Running in system mode: no

Finally I did set up a headless server on ubuntu 18.04.6 LTS with Kodi and equalizer, so I can confirm that it is working on Ubuntu 18.04.6 LTS without any problems.
Reply
#24
Hi @wastis,
thanks for your help.
I got it running by adding 'Environment = PULSE_DBUS_SERVER=unix:path=/run/user/1000/pulse/dbus-socket' to my kodi_start.service
Code:

[Unit]
Description = kodi-x11 start
Requires = dbus.service
After = systemd-user-sessions.service sound.target network-online.target

[Service]
User = michael
Group = michael
Type = simple
Environment = DISPLAY=:0
Environment = PULSE_DBUS_SERVER=unix:path=/run/user/1000/pulse/dbus-socket
ExecStart =  /home/michael/xbmc/build/kodi-x11
Restart = on-abort
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy = multi-user.target

I still have a couple of questions:
  which output-device do I have to select in System->Audio? I see among others HDMI/PULSAUDiO (which I usually use) but also EQUALIZER?
  which output device do I have to select in the Equalizer-Plugin? is it HDMI/PULSAUDIO?
  what is the best way to use a specific (default) profile automatically?
  am I right to say that the plugin a NOT working when I use PASSTHROUGH? (I am using it most of the times to enjoy DOLBY/DTS-sound ...

Thank you!
Reply
#25
I am glad it worked for you.

Yes, pulseaudio equalizer should not touch the audio stream if you use pass through - the purpose of pass through. The equalizer should not be in the output chain in this case.

You have a number of options to configure your output. So in principle,  you could select any pulse audio device as output device and switch pulseaudio equalizer on/off, dependent if you want to use pass through or not. You could also select "Equalizer" as output, which then routes it's output to default pulse audio device. In this case, you do not have pass through.

Another option could be to have another persistent equalizer module loaded with your preferred settings (channels, rate, output device) and select between this persistent equalizer and direct output, dependent on pass through. More details on how to do this is in the advanced configuration in github.

Automatic switch depended on pass through is currently not implemented. I need to investigate on whether this can be done and implemented. However my focus and priority is currently on digital room correction per channel.

Enjoy
Reply
#26
Thank you so much for your fast and efficient help!
Reply
#27
@MicTie 

Ok, I think I may have found the root cause of the problem testing your startup script. It seems that Kodi and with this the addon is launched before the filesystem /run/user/1000/pulse is set-up properly. So in your case, the pulseaudio dbus service is not available by the time Kodi is launched. 

I avoid this by using "su" in my startup. Maybe there is an optimization of the "After" targets possible.

@all,  a recommendation on an optimized startup script would be appreciated.
Reply
#28
@wastis 
my kodi startup required fiddling around for quite some time to start KODI via YATSE from my phone ...

Currently I am happy that it's working with the equalizer

Thanks!
Reply



Logout Mark Read Team Forum Stats Members Help
HOWTO Kodi with Equalizer on LinuxMint 20.10
This forum uses Lukasz Tkacz MyBB addons.