Librespot Add-on

  • Dear All,

    I´ve noticed that with librespot under libreelec on rpi4b, the sound is by default compressed. I´m not talking about compression as in mp3 or such, but when using a compressor for decreasing the dynamics of the file in order to increase its loudness.

    On some stuff, especially music from before the 90´s, this can have horrible consequences. How do I disable this?

    Please note that the latest available version from the libreelec repository is 9.0.115, and this could be something that has been made optional in later releases. I wouldn´t know how to install newer versions though, so if this is a solution, please advise. I assume that none of the settings in the settings.xml file has any impact on this...
    And, I should add that libreelecs spotify service (which fails to impress in any other way compared to librespot) does NOT add this compression, so it´s not like a thing spotify always does that can´t be turned off.

    Example: spotify:track:5BSkUsTWQWfctzP5EF8XnK - that´s really not how that song should sound!

    I´m playing it now through tuneblade, a decent alternative to play all pc audio through kodi, and this sounds how it should. I think I do recall though that it has some bugs with suddenly stopping to work, so I´d prefer librespot to not use compression.

    Also, tuneblade makes it impossible for me to have a chat over my headset while listening to spotify, since what I´m using here in my living room is a raspberry that´s RDPing into my PC on the 2nd floor, and that solution only allows one audio device, meaning that I´d get the party I´m calling talking through the libreelec raspberry.

    Edited 3 times, last by jazzlpunk (December 20, 2019 at 8:21 PM).

  • Dear all,

    I'm using LibreELEC 9.0.2 on two RPi3s, same setup with only one difference: One is playing audio via ALSA, the other via PULSE. On the former, Librespot is playing directly to sysdefault card via ALSA with no user mode switched on. Anything works well if I choose this output device on my mobile with Spotify app running. On the latter, Librespot is configured to play via "Kodi" output mode with no user mode either, it could be found as valid output device if nothing else is currently playing. First, it shows up with a different symbol (screen icon instead of loudspeaker icon) in Spotify app, second, if I try to switch to it, the app switches indeed, but only for a very short time and then switches back to the mobile device itself. "journalctl -u service.librespot" just tells me that the service is stopped after successful authentication with my spotify credentials. The other RPi using ALSA tells me instead that tracks are loaded and played successfully at the same place of the log dump.

    Thus it seems as if PULSE output is causing this problem. Does someone have similar issues?

    Best

  • I want to run Librespot on a Amlogic S905X box, but it doesn't work. On my other S905W it works fine.

    The S905X uses Alsa audio instead of Pulse, but there's no alsa support in the current amlogic version 'Invalid backend' ?

    Can you please build a version to test alsa on a Amlogic S905x ?

    S905W:

    S905X

  • after having solved the above issue, I received an update for the librespot addon (version 118), throught the update channel.

    this update again delivered a non functional binary:

    journalctl -u service.librespot


    Jan 06 12:03:12 LibreELEC systemd[1]: Started librespot.

    Jan 06 12:03:14 LibreELEC sh[959]: [2020-01-06T11:03:14Z INFO librespot] librespot 54f729222c (2019-12-28). Built on 2019-12-

    Jan 06 12:03:14 LibreELEC sh[959]: *** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi

    Jan 06 12:03:14 LibreELEC sh[959]: *** WARNING *** Please fix your application to use the native API of Avahi!

    Jan 06 12:03:14 LibreELEC sh[959]: *** WARNING *** For more information see <avahi-compat.htm

    Jan 06 12:03:14 LibreELEC librespot[979]: *** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer o

    Jan 06 12:03:14 LibreELEC librespot[979]: *** WARNING *** Please fix your application to use the native API of Avahi!

    Jan 06 12:03:14 LibreELEC librespot[979]: *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-com

    Jan 06 12:03:14 LibreELEC sh[959]: thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: DNSError(Unknown)',

    Jan 06 12:03:14 LibreELEC sh[959]: stack backtrace:

    Jan 06 12:03:15 LibreELEC sh[959]: 0: 0x55c3dbe49c94 - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 1: 0x55c3dbe709cc - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 2: 0x55c3dbe44a57 - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 3: 0x55c3dbe4c325 - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 4: 0x55c3dbe4c016 - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 5: 0x55c3dbe4ca25 - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 6: 0x55c3dbe4c5c2 - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 7: 0x55c3dbe4c4b6 - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 8: 0x55c3dbe6c82a - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 9: 0x55c3dbe6c927 - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 10: 0x55c3db9f62be - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 11: 0x55c3db9ce180 - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 12: 0x55c3db9d0043 - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 13: 0x55c3dbe4c453 - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 14: 0x55c3dbe547da - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 15: 0x55c3dbe4cf1d - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 16: 0x55c3db9cf382 - main

    Jan 06 12:03:15 LibreELEC sh[959]: 17: 0x7fda613d2b5b - __libc_start_main

    Jan 06 12:03:15 LibreELEC sh[959]: at ../csu/libc-start.c:308

    Jan 06 12:03:15 LibreELEC sh[959]: 18: 0x55c3db9aa1aa - <unknown>

    Jan 06 12:03:15 LibreELEC sh[959]: 19: 0x0 - <unknown>

    Jan 06 12:03:15 LibreELEC systemd[1]: service.librespot.service: Main process exited, code=exited, status=101/n/a

    Jan 06 12:03:15 LibreELEC systemd[1]: service.librespot.service: Failed with result 'exit-code'.

    Jan 06 12:03:15 LibreELEC systemd[1]: service.librespot.service: Service RestartSec=100ms expired, scheduling restart.

    Jan 06 12:03:15 LibreELEC systemd[1]: service.librespot.service: Scheduled restart job, restart counter is at 1.

    Jan 06 12:03:15 LibreELEC systemd[1]: Stopped librespot.

    after replacing the binary with the version I compiled myself ... everything is back to normal.

    If I was on a custom linux installation I could understand such issues ... but as I am under libreelec my freedom to screw up my system config is quite limited ....

    So I wonder why noone else seems to have this problem ....

  • Could you please share your binary so I can try it out as well?

    I tried compiling it myself as well but the build process failed. Maybe I didn't have all the required dependencies? Anyways, it would be nice if I could try your binary! :)

  • However, revision 119 of the addon will bring back an ALSA backend to librespot.

    It will then be possible to start librespot for ALSA with a separate custom system.d service

    I'm on LibreELEC 9.2.0 on RPi2.arm. Will version 119 also be released for this combination?

  • Since a couple of months my LibreELEC librespot client isn't listed under available devices any more, although it seems to start without errors. The log does contain the following lines when I activate the addon:

    Code
    2020-02-25 20:27:34.940 T:1068483456  NOTICE: Librespot: service started
    2020-02-25 20:27:34.940 T:1068483456  NOTICE: Librespot: monitor started
    2020-02-25 20:27:34.940 T:1068483456  NOTICE: Librespot: player started
    2020-02-25 20:27:34.972 T:1068483456  NOTICE: Librespot: playback started
    2020-02-25 20:27:34.972 T:1068483456  NOTICE: Librespot: stop librespot
    2020-02-25 20:27:35.092 T:1085268864  NOTICE: Librespot: control pipe started

    Is this output OK? Because of "stop librespot" I guess here is something wrong.

    When I start the service directly via ssh everything is fine:

    Code
    LibreELEC:~/ # librespot --name=foo --username=johndoe
    [2020-02-25T19:38:24Z INFO  librespot] librespot 710041d5d9 (2020-02-02). Built on 2020-02-03. Build ID: nHEi7Chn
    Password for johndoe:
    *** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi.
    *** WARNING *** Please fix your application to use the native API of Avahi!
    *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
    [2020-02-25T19:38:41Z INFO  librespot_core::session] Connecting to AP "gew1-accesspoint-b-h7lp.ap.spotify.com:4070"
    [2020-02-25T19:38:41Z INFO  librespot_core::session] Authenticated as "johndoe" !
    [2020-02-25T19:38:41Z INFO  librespot_playback::audio_backend::alsa] Using alsa sink
    [2020-02-25T19:38:41Z INFO  librespot_core::session] Country: "DE"

    The client is listed under available devices till I abort it.

    So where is the difference? I've double checked my password in LibreELEC addon settings and also tried to listen as anonymous with no success.

    Using Librespot 9.2.0.120 on LibreELEC 9.2.0 on an RPi 2.

    EDIT: I solved it by uninstall (including settings), restart and new install of latest version /shrug

    Edited once, last by donutpanic (February 25, 2020 at 8:21 PM).

  • once again after autoupdate from 28. February: librespot binary is broken

    after replacing the binary with my self build one the device appeared back on spotify connect ... but trying to play a song I hear no audio, even though the the song appears to be played on the client device.

    Then I removed the --backend pulseaudio switch from librespot.start

    now everything works again.

    any thoughts why this is would be highly appreciated.

    • Official Post

    once again after autoupdate from 28. February: librespot binary is broken

    after replacing the binary with my self build one the device appeared back on spotify connect ... but trying to play a song I hear no audio, even though the the song appears to be played on the client device.

    Then I removed the --backend pulseaudio switch from librespot.start

    now everything works again.

    any thoughts why this is would be highly appreciated.

    Hi Sappi,

    According to the log you provide, the binary is not broken but something in your configuration is.

    First, if you remove the --backend flag then librespot does not use pulseaudio but alsa, which is out of the scope of the addon.

    Then, your logs report a DNS issue, so let us try inspecting this:

    1. What version of LibreELEC are you running (hardware and version)?

    2. Have you set the wait for network option in LibreELEC network configuration?

    3. Is Avahi enabled in LibreELEC services configuration?

    4. Do you have a Spotify Premium account?

    5. Have you tried running in user mode, where you set Spotify username and password in the settings of the addon?

    6. Can you provide the output of "ldd /storage/.kodi/addons/service.librespot/bin/librespot", the version shipped with the addon?

  • Hi awiouy,

    sorry not coming back on that for a while. Howewer, now that my system got broken again (likely doue to an update again). I am eager to trace the root cause.

    As a starting point I:

    1. deinstalled librespot addon

    2. deleted the zip archive from .kodi/addons/packages/

    3. rebootet the machine

    4. reinstalled addon

    5. rebootet the machine

    6. journalctl -u service.librespot returns the previously reported error log

    So find the requested information below

    1.) LibreELEC (official): 9.2.0 (Generic.x86_64)

    2.) no, disabled

    3.) no, disabled

    4.) yes, have premium

    5.) yes, tried but when the service is crashed, but prefer not to use, because we have mutiple accounts in my home, that want to use the service

    6.) ldd /storage/.kodi/addons/service.librespot/bin/librespot

    linux-vdso.so.1 (0x00007fff5d5fd000)

    libpulse.so.0 => /usr/lib/libpulse.so.0 (0x00007fccab1a7000)

    libpulse-simple.so.0 => /usr/lib/libpulse-simple.so.0 (0x00007fccab1a0000)

    libasound.so.2 => /usr/lib/libasound.so.2 (0x00007fccab0de000)

    libdns_sd.so.1 => /storage/.kodi/addons/service.librespot/lib/libdns_sd.so.1 (0x00007fccab0d5000)

    libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fccab0d0000)

    librt.so.1 => /usr/lib/librt.so.1 (0x00007fccab0c6000)

    libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fccab0a3000)

    libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fccab089000)

    libc.so.6 => /usr/lib/libc.so.6 (0x00007fccaaed3000)

    /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fccab8cb000)

    libm.so.6 => /usr/lib/libm.so.6 (0x00007fccaad93000)

    libpulsecommon-12.2.so => /usr/lib/pulseaudio/libpulsecommon-12.2.so (0x00007fccaacbe000)

    libdbus-1.so.3 => /usr/lib/libdbus-1.so.3 (0x00007fccaac76000)

    libavahi-common.so.3 => /usr/lib/libavahi-common.so.3 (0x00007fccaac67000)

    libavahi-client.so.3 => /usr/lib/libavahi-client.so.3 (0x00007fccaac56000)

    libsystemd.so.0 => /usr/lib/libsystemd.so.0 (0x00007fccaabb7000)

    would be great if the would tell you something meaningful ...

    Best Regards

    Sappi

  • Hi Sappi,

    To solve your issue either enable avahi in LibreELEC services or set user name and password in user mode in Librespot settings.

    Also, wait for network is recommended for Librespot and for other services.

    Librespot for LibreELEC is built with dns-sd (avahi) rather than mdns, for historical reasons and also because user interaction is smoother.

    Hope this helps.

  • Hello Sappi,

    did you have more luck with Avahi turned on? I am asking because I had likely the same problem, but as awiouy mentioned earlier, Avahi must be turned on. That was my problem.