pssc / ha-addon-squeezelite

Squeezelite Player Addon for Home Assistant, for use with a Logitech Media Server
GNU General Public License v3.0
7 stars 0 forks source link

Squeezelite integration issue on Intel NUC. #9

Open eric-joris opened 6 months ago

eric-joris commented 6 months ago

Squeezelite add-on gives a problem on Intel NUC box (NUC5i3RYK).

The problem:

Home Assistant on Intel NUC: :* Core2024.2.1

Logitech Media Server Versie: 8.3.1 LMS Add-on: 8.3.1.60 Squeezelite Add-on: 0.0.17

piCorePlayer: v6.1.0 | linux 4.19.122-pcpCore | piCore v10.3pCP | Squeezelite v1.9.9-1386-pCP

Is there any way I can tune the Squeezelite add-on in the hope I can resolve this issue?

pssc commented 6 months ago

@eric-joris are you going to the HW direct for the USB sound otherwise your still going through the pulse audio subsystem, which to be quite frank make sync almost impossible.

eric-joris commented 6 months ago

@pssc Thanks for the reply. I have I resolved the issue by changing the Squeezelite build options to “alsa”. The skips in the songs are gone and it sounds smooth. I now use the internal sound system of the NUC. The syncing with other players is now acceptable for my purpose (players are in different rooms). However the syncing not perfect. I think that a little explanation on this topic in the addon documentation would really help.

pssc commented 6 months ago

@eric-joris using the pulse alsa addon? or using the HW direct via alsa? Is pulse in HA also trying use this HW? that could be an issue with the sync/audio?

Sure I am happy to augment the docs, though I am not sure what you have done, there are so many permutations I just tried not so restrict what people could configure but again happy to add docs for a use case with a config recipe.

What would you have found useful to know?

eric-joris commented 6 months ago

@pssc I'm not sure if I use the pulse alsa addon or the HW direct via alsa. How can I change this? At the moment I only have selected alsa at the Option: Build. I can choose between pa, alsa, pulse. It is also not clear to me if/what I have to put in the "Output" field or in the "Build" field (I already have choosen "alsa" above). I think that some explanation of these setting in the documentation would be very helpfull.

Here is the log of the Squeezelite addon:

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting


Add-on: Squeezelite Squeezelite player for Logitech Media Server on home assistant

Add-on version: 0.0.17 You are running the latest version of this add-on. System: Home Assistant OS 11.5 (amd64 / generic-x86-64) Home Assistant Core: 2024.2.1 Home Assistant Supervisor: 2024.01.1

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-timezone: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started [21:40:47] INFO: Configuring timezone (Europe/Brussels)... s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service base-addon-timezone successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun squeezelite (no readiness notification) [21:40:48] INFO: Starting the Squeezelite options processing... s6-rc: info: service legacy-services successfully started [21:40:49] INFO: Squeezelite client name:HAS-SqueezeLite [21:40:49] INFO: Using Squeezelite pulse audio version on x86_64 [21:40:49] INFO: Forcing Squeezelite build alsa [21:40:49] NOTICE: Squeezelite possible outputs(alsa)... Output devices: null - Discard all samples (playback) or generate zero samples (capture) lavrate - Rate Converter Plugin Using Libav/FFmpeg Library samplerate - Rate Converter Plugin Using Samplerate Library speexrate - Rate Converter Plugin Using Speex Resampler jack - JACK Audio Connection Kit oss - Open Sound System pulse - PulseAudio Sound Server speex - Plugin using Speex DSP (resample, agc, denoise, echo, dereverb) upmix - Plugin for channel upmix (4,6,8) vdownmix - Plugin for channel downmix (stereo) with a simple spacialization default - Default ALSA Output (Home Assistant PulseAudio Sound Server)

[21:40:49] INFO: nice -n -10 squeezelite -M SqueezeLite-HA-Addon -N /data/name -m 82:c9:9d:0c:18:de -d all=warn

pssc commented 6 months ago

So your going alsa back into the pulse audio system provided via HA the squeezelite pulse build uses pulse directly, you have protection mode off? as it can't see the Hardware directly ATM at all.

eric-joris commented 6 months ago

If I understand you correctly, you say that the sound path is going first through alsa and back throu pulse?

I had protection mode on, which I now turned off. Here is the log file with protection off. Wauw, much more information on the output hardware. I see now 3 output devices (HDMI, USB DAC and ALC283) each with several different settings.
I assume my best choises are, 1 for the NUC jack: "hw:CARD=PCH,DEV=0" and for the USB DAC: "hw:CARD=HIFIRef,DEV=0". If I choose any of these two, will I skip the pulse system? Also, how do I select the output device to use?

Many thanks.

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting


Add-on: Squeezelite Squeezelite player for Logitech Media Server on home assistant

Add-on version: 0.0.17 You are running the latest version of this add-on. System: Home Assistant OS 11.5 (amd64 / generic-x86-64) Home Assistant Core: 2024.2.1 Home Assistant Supervisor: 2024.01.1

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-timezone: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started [10:59:27] INFO: Configuring timezone (Europe/Brussels)... s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service base-addon-timezone successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun squeezelite (no readiness notification) [10:59:27] INFO: Starting the Squeezelite options processing... s6-rc: info: service legacy-services successfully started [10:59:28] INFO: Squeezelite client name:HAS-SqueezeLite [10:59:28] INFO: Using Squeezelite pulse audio version on x86_64 [10:59:28] INFO: Forcing Squeezelite build alsa [10:59:28] NOTICE: Squeezelite possible outputs(alsa)... Output devices: null - Discard all samples (playback) or generate zero samples (capture) lavrate - Rate Converter Plugin Using Libav/FFmpeg Library samplerate - Rate Converter Plugin Using Samplerate Library speexrate - Rate Converter Plugin Using Speex Resampler jack - JACK Audio Connection Kit oss - Open Sound System pulse - PulseAudio Sound Server speex - Plugin using Speex DSP (resample, agc, denoise, echo, dereverb) upmix - Plugin for channel upmix (4,6,8) vdownmix - Plugin for channel downmix (stereo) with a simple spacialization default - Default ALSA Output (Home Assistant PulseAudio Sound Server) hw:CARD=HDMI,DEV=3 - HDA Intel HDMI, HDMI 0 - Direct hardware device without any conversions hw:CARD=HDMI,DEV=7 - HDA Intel HDMI, HDMI 1 - Direct hardware device without any conversions hw:CARD=HDMI,DEV=8 - HDA Intel HDMI, HDMI 2 - Direct hardware device without any conversions plughw:CARD=HDMI,DEV=3 - HDA Intel HDMI, HDMI 0 - Hardware device with all software conversions plughw:CARD=HDMI,DEV=7 - HDA Intel HDMI, HDMI 1 - Hardware device with all software conversions plughw:CARD=HDMI,DEV=8 - HDA Intel HDMI, HDMI 2 - Hardware device with all software conversions hdmi:CARD=HDMI,DEV=0 - HDA Intel HDMI, HDMI 0 - HDMI Audio Output hdmi:CARD=HDMI,DEV=1 - HDA Intel HDMI, HDMI 1 - HDMI Audio Output hdmi:CARD=HDMI,DEV=2 - HDA Intel HDMI, HDMI 2 - HDMI Audio Output dmix:CARD=HDMI,DEV=3 - HDA Intel HDMI, HDMI 0 - Direct sample mixing device dmix:CARD=HDMI,DEV=7 - HDA Intel HDMI, HDMI 1 - Direct sample mixing device dmix:CARD=HDMI,DEV=8 - HDA Intel HDMI, HDMI 2 - Direct sample mixing device usbstream:CARD=HDMI - HDA Intel HDMI - USB Stream Output hw:CARD=HIFIRef,DEV=0 - HIFI-Ref, USB Audio - Direct hardware device without any conversions plughw:CARD=HIFIRef,DEV=0 - HIFI-Ref, USB Audio - Hardware device with all software conversions sysdefault:CARD=HIFIRef - HIFI-Ref, USB Audio - Default Audio Device front:CARD=HIFIRef,DEV=0 - HIFI-Ref, USB Audio - Front output / input surround21:CARD=HIFIRef,DEV=0 - HIFI-Ref, USB Audio - 2.1 Surround output to Front and Subwoofer speakers surround40:CARD=HIFIRef,DEV=0 - HIFI-Ref, USB Audio - 4.0 Surround output to Front and Rear speakers surround41:CARD=HIFIRef,DEV=0 - HIFI-Ref, USB Audio - 4.1 Surround output to Front, Rear and Subwoofer speakers surround50:CARD=HIFIRef,DEV=0 - HIFI-Ref, USB Audio - 5.0 Surround output to Front, Center and Rear speakers surround51:CARD=HIFIRef,DEV=0 - HIFI-Ref, USB Audio - 5.1 Surround output to Front, Center, Rear and Subwoofer speakers surround71:CARD=HIFIRef,DEV=0 - HIFI-Ref, USB Audio - 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers iec958:CARD=HIFIRef,DEV=0 - HIFI-Ref, USB Audio - IEC958 (S/PDIF) Digital Audio Output dmix:CARD=HIFIRef,DEV=0 - HIFI-Ref, USB Audio - Direct sample mixing device usbstream:CARD=HIFIRef - HIFI-Ref - USB Stream Output hw:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - Direct hardware device without any conversions plughw:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - Hardware device with all software conversions sysdefault:CARD=PCH - HDA Intel PCH, ALC283 Analog - Default Audio Device front:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - Front output / input surround21:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - 2.1 Surround output to Front and Subwoofer speakers surround40:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - 4.0 Surround output to Front and Rear speakers surround41:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - 4.1 Surround output to Front, Rear and Subwoofer speakers surround50:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - 5.0 Surround output to Front, Center and Rear speakers surround51:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - 5.1 Surround output to Front, Center, Rear and Subwoofer speakers surround71:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers dmix:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - Direct sample mixing device dsnoop:CARD=PCH,DEV=0 - HDA Intel PCH, ALC283 Analog - Direct sample snooping device usbstream:CARD=PCH - HDA Intel PCH - USB Stream Output

[10:59:28] INFO: nice -n -10 squeezelite -M SqueezeLite-HA-Addon -N /data/name -m 82:c9:9d:0c:18:de -d all=warn

eric-joris commented 6 months ago

@pssc I tried to put the 2 devices "hw:CARD=PCH,DEV=0" and "hw:CARD=HIFIRef,DEV=0" in the output field of the addon configuration but I get the error "unable to open output device: ...", see below:

[12:10:22] INFO: nice -n -10 squeezelite -M SqueezeLite-HA-Addon -N /data/name -o hw:CARD=PCH,DEV=0 -m 82:c9:9d:0c:18:de -d all=warn [12:10:22.081885] test_open:281 playback open error: Device or resource busy [12:10:22.081939] output_init_common:401 unable to open output device: hw:CARD=PCH,DEV=0 [12:10:22] WARNING: Halt add-on

pssc commented 6 months ago

@eric-joris yes with sound path, so here I think pulse is using that card as well? It isnt the only sound system in the NUC so if you can convince HA's pulse to use something else , Might be worth playing around with alsa via aplay and speaker test from the CLI hwplug has a alsa software layer so is more forgiving and will covert things that are not suitable for the HW.

eric-joris commented 6 months ago

@pssc Thanks for the hint. I tried in the HA terminal to run aplay but command not found. I tried to instal the alsa utils (apt-get install alsa-utils) but also here is command not found.

pssc commented 6 months ago

@eric-joris the web terminal uses alpine rather than debian so apk add xxx also use the "Advanced SSH & Web Terminal" I think that has the alsa-utils installed by default.

eric-joris commented 6 months ago

@pssc I installed the "Advanced SSH & Web Terminal". alsa-utils are indeed preinstalled. Great tool but I will need some time to learn how to use it. Thanks so far for your persistance in helping a newby.

eric-joris commented 6 months ago

@pssc I'm puzzled with the discrepancy between the output devices that I see on the "HA audio info" command and the "aplay -l & -L" commands.

HA audio info gives: image

aplay -l does not find a sound card

while aplay -L gives: image

So I'm still very much confused. Is there any way that I can select an output from the HA audio info set of devices?

pssc commented 6 months ago

@eric-joris disable protection mode on the terminal. rerun aplay