Librespot Add-on

  • Hello! I understand that setting 320kbps is setting for output quality, which is then streamed as PCM to audio device - that is why all songs from spotify show as PCM 1440kbps in KODI.

    I am wondering if it is also possible to set quality of input stream that is requested from spotify servers and how to see that quality.

    Thank you, Jan

    Just FYI ...PCM stands for Pulse Code Modulation , and the algorithm do 8,000 samples per second and each one are coded in 8 bits, 64kbps....

    Spotify as Youtube , Netflix, etc....uses adaptive streaming which use Input Stream Adaptive Video Player for2 purprouses that I know...DRM (De)/Codification and Performace Adaptation , thoses processes are done using a protocolor "Language" called MSL , who negociete the playback...if you want to override the auto adaptation , just filter the manifiest received.

    I did it on CastangaITs Netflix AddOn, there is a parameter that limits the resolution of the propolsals...so the broker (AddOn) Decides what stream will use, instead of the Consumer (MediaPlayer).

    Cheers!

  • Sadly, within about 2 weeks, it has started skipping like a spring lamb. It will play for a few seconds, then pause for a few seconds, then play again. Sometimes it will for OK for hours, but I can't actually rely on it to play a song all the way through, never mind an album or playlist. Can I provide some information for you to look at it? If I switch playback to the phone, or send it to the pi via shairplay, there are no skips.


    I understand that there may be other matters taking up your time at present, and perhaps you would prefer not to waste energy on the Pi3 and LibreELEC 10.

  • Hi All, may I get some help please where can I download this Spotify addon for KODI?

    My HW is an old AMD APU x86/64 and a pendrive with LibreELEC 10.0.1 Generic.x86_64 installed.

    Does this version supported?

    If not, which is the latest supported LibreELEC version for X86_64?

    Thank you so much for your kind help!

    Darq

  • Does anybody have a direct dowload link to older versions of Librespot 9.2. or 9.1? It's the only version that seems to work on my amlogic s912. Thank you in advance for any help.

    EDIT: I turned on Avahi and it works! Thanks anyway all

  • I've got an "too many errors" message on starting latest librespot Version on LE 10.0.2.

    I've got the same on LE 9, then made a fresh install yesterday to LE 10.0.2, librespot was working well and now the same error again.

    Anyone else having this problem?

  • I've got an "too many errors" message on starting latest librespot Version on LE 10.0.2.

    I've got the same on LE 9, then made a fresh install yesterday to LE 10.0.2, librespot was working well and now the same error again.

    Anyone else having this problem?

    Problem solved, "ZeroConfig" was disabled ;)

  • I recently installed LibreELEC 10.0.2 on my RPI3. First I installed the Librespot addon (Version 10.0.0.129).

    But Librespot doesn't work. I can see Librespot at my Spotify App on my smartphone, but after choosing Librespot in my Spotify app no music plays to start.

    In logs I can see that I get every 10s the log message, as long the Librespot addon is running :

    pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused

    Code
    Aug 05 18:10:36 Wohnzimmer librespot[968]: *** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi.
    Aug 05 18:10:36 Wohnzimmer librespot[968]: *** WARNING *** Please fix your application to use the native API of Avahi!
    Aug 05 18:10:36 Wohnzimmer librespot[968]: *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
    Aug 05 18:10:41 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused
    Aug 05 18:10:51 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused
    Aug 05 18:11:01 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused
    Aug 05 18:11:11 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused
    Aug 05 18:11:21 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused
    Aug 05 18:11:31 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused
    Aug 05 18:11:41 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused

    Any ideas how I can fix this?

  • I recently installed LibreELEC 10.0.2 on my RPI3. First I installed the Librespot addon (Version 10.0.0.129).

    But Librespot doesn't work. I can see Librespot at my Spotify App on my smartphone, but after choosing Librespot in my Spotify app no music plays to start.

    In logs I can see that I get every 10s the log message, as long the Librespot addon is running :

    pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused

    Code
    Aug 05 18:10:36 Wohnzimmer librespot[968]: *** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi.
    Aug 05 18:10:36 Wohnzimmer librespot[968]: *** WARNING *** Please fix your application to use the native API of Avahi!
    Aug 05 18:10:36 Wohnzimmer librespot[968]: *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
    Aug 05 18:10:41 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused
    Aug 05 18:10:51 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused
    Aug 05 18:11:01 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused
    Aug 05 18:11:11 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused
    Aug 05 18:11:21 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused
    Aug 05 18:11:31 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused
    Aug 05 18:11:41 Wohnzimmer pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused

    Any ideas how I can fix this?

    See Librespot no longer works for the workaround

  • I installed this service but I cannot see it from my Spotify apps with or without discovery (with correct credentials). Any idea what might be wrong?

    Are you on the same network with your Spotify apps? Same wifi for mobile.

    Is UPnP enabled in your router settings?

  • Hi. I don't know why Librespot is not working for me on LE Rock64. I have all remote functions turned on. I checked on LE Generic Intel and on RK3328 TV BOX and it works. Does anyone have any advice?

  • I'm running into the following error from time to time on a RPi3B:

    Code
    Librespot: monitor started
    NOTICE: Librespot: ['librespot', '--backend', 'pulseaudio', '--bitrate', '320', '--cache', 'cache', '--device', 'librespot', '--device-type', 'TV', '--disable-audio-cache', '--name', 'Librespot@LibreELEC', '--notify-kodi', '--autoplay']
    ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
    Error Type: <type 'exceptions.OSError'> 
    Error Contents: [Errno 12] Cannot allocate memory

    Followed by traceback section.

    There's usually about 300MB of free memory when this occurs, so it shouldn't be due to the system being out of memory I would think but maybe that's not enough? Has anyone else experienced this issue?

  • I'm not sure if this is something that happens with everyone or if it's intentional or if it even is happening for everyone, so I thought I would post here to see.

    After some time of inactivity, my Kodi device will stop showing up on the list of Spotify Connect devices I have locally. It seems that going to the settings and re-saving them (without making any changes) will refresh the service and make it start showing up there again.

    It would be awesome if I didn't have to update the settings of the plugin every time I wanted to connect. I will probably end up writing a plugin that automatically triggers the onSettingsChanged event every 30 minutes, or something along those lines, but I wanted to just double check to see if anyone else had any better solutions before doing that.

    Anyone else dealing with this or have any suggestions?

  • I recently installed LibreELEC 10.0.2 on my RPI3. First I installed the Librespot addon (Version 10.0.0.129).

    But Librespot doesn't work. I can see Librespot at my Spotify App on my smartphone, but after choosing Librespot in my Spotify app no music plays to start.

    In logs I can see that I get every 10s the log message, as long the Librespot addon is running :

    pulseaudio[311]: W: [pulseaudio] sap.c: sendmsg() failed: Connection refused

    Did you figure this out yet?

    This is a "me too" post: seeing exactly the same thing (also running LibreElec 10.0.02, Librespot 10.0.0.129, but on an Intel NUC).

    I can connect to Librespot from the phone, start playing, but get no sound.

    Error messages are also identical ("sendmsg failed: connection refused")

  • (also running LibreElec 10.0.2, Librespot 10.0.0.129, but on an Intel NUC).

    I can connect to Librespot from the phone, start playing, but get no sound.

    Error messages are also identical ("sendmsg failed: connection refused")

    Updated to LibreElec 10.0.3 now.

    I managed to get sound by doing the following:

    - install Librespot, but disable it

    - ssh into the machine (or open a terminal on it, assuming this is possible), and running librespot manually like this:

    Code
    librespot --verbose --backend alsa --device="hw:1,0" --bitrate 320 --cache cache --disable-audio-cache --name boba --notify-kodi

    - before that I had run "aplay -l" to get the device numbers of my audio output (a USB DAC):

    Code
    boba:~ # aplay -l
    **** List of PLAYBACK Hardware Devices ****
    ... (lines deleted) ...
    card 1: Set [C-Media USB Headphone Set], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0

    The way that librespot runs when the plugin is enabled (but producing that connect error) is as follows:

    Code
    boba:~/.config # ps -ef|grep libre
      900 root      0:13 librespot --backend pulseaudio --bitrate 320 --cache cache --device librespot --device-type TV --disable-audio-cache --name Librespot@boba --notify-kodi

    So now I'm thinking it doesn't work because of some pulseaudio configuration problem.

    At least I have sound now :)

    I'll dig a bit more.

  • It actually made sense to start librespot with --backend alsa, since my USB DAC is on an alsa output (!)

    From this thread (I think) I found:

    Code
    cd /storage/.config/system.d
    
    cp /storage/.kodi/addons/service.librespot/miscellaneous/service.librespot-alsa.service .
    
    systemctl enable service.librespot-alsa.service

    The above makes sure that librespot auto-starts librespot at boot, like so:

    Code
    /storage/.kodi/addons/service.librespot/bin/librespot --backend alsa --bitrate 320 --cache /storage/.config/lsa_cache --device-type computer --disable-audio-cache --name Librespot ALSA Restart=always

    edit: I also had to create the file /storage/.config/asound.conf, to tell alsa where the USB DAC sits:

    Code
    pcm.device {
               type hw
               card 1
               device 0
    }
    
    pcm.!default {
                 type plug
                 slave.pcm "device"
    }

    (not sure yet what the 2nd section does here)

    So now everything works, except when I switch back to Kodi, to watch something, or play music from there for example: it seems that librespot has taken the audio output, and Kodi outputs no sound :( (the USB DAC is also no longer listed in the available audio outputs in the system settings).

    If I reboot, then Kodi plays audio ok.

    There should be an easy way to switch between the two, or maybe (?) get them to both use pulseaudio.

    Edited 2 times, last by audiobobo (December 7, 2022 at 8:31 PM).