[HowTo] Spotify-Connect support via Raspotify (LibreSpot)

#104

Just a thought: Kodi has an option ‘keep audio device alive’, or words to that effect. You might want to take a look at how that is set in your Kodi. If it is set to ‘always’ then it may never allow Raspotify to access the device. Otherwise I don’t really have any suggestions. It’s been working fine for me for months with what appear to be identical settings to yours.

#105

Hey Bluefuzz, good thought mate. Unfortunately, I had that setting turned off. After you gave me this idea, I tried to play around with this kodi settings and raspotify again, but without change.

The issue remains.

I have VERO 4K+, with KODI 17.6 (I tried even new ofc update to KODI 18). Sound output is SPDIF. It’s visible on spotify network like playeble device, I can easy connect to it, I can press play and play it over OSMC device, but the sound throwing this error msg and no music is playing. I can’t find any similar error msg on the web. I tried post it on github.

What I think, it’s maybe something with ALSA(coz I don’t understand Alsa how it wokrs and how it’s connected with OSMC / raspotify) I think it’s sending audio signal to different port, just don’t know how to test it.

#106

have the same problem :frowning: latest osmc and raspotify 13.1

root@osmc:/home/osmc# systemctl status raspotify       
* raspotify.service - Raspotify
   Loaded: loaded (/lib/systemd/system/raspotify.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-05-04 09:47:24 CEST; 8min ago
  Process: 3589 ExecStartPre=/bin/chown raspotify:raspotify /var/cache/raspotify (code=exited, status=0/SUCCESS)
  Process: 3586 ExecStartPre=/bin/mkdir -m 0755 -p /var/cache/raspotify (code=exited, status=0/SUCCESS)
 Main PID: 3593 (librespot)
   CGroup: /system.slice/raspotify.service
           `-3593 /usr/bin/librespot --name osmc --backend alsa --bitrate 320 --disable-audio-cache --enable-volume-normalisation --linear-volume --initial-volume=100

May 04 09:55:05 osmc librespot[3593]: ERROR:librespot_playback::audio_backend::alsa: Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_buffer_size_near' failed with error 'EINVAL: Invalid argument'
May 04 09:55:05 osmc librespot[3593]: ERROR:librespot_playback::player: Could not start audio: Alsa error: PCM open failed
May 04 09:55:10 osmc librespot[3593]: ERROR:librespot_playback::audio_backend::alsa: Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_buffer_size_near' failed with error 'EINVAL: Invalid argument'
May 04 09:55:10 osmc librespot[3593]: ERROR:librespot_playback::player: Could not start audio: Alsa error: PCM open failed
May 04 09:55:15 osmc librespot[3593]: ERROR:librespot_playback::audio_backend::alsa: Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_buffer_size_near' failed with error 'EINVAL: Invalid argument'
May 04 09:55:15 osmc librespot[3593]: ERROR:librespot_playback::player: Could not start audio: Alsa error: PCM open failed
May 04 09:55:20 osmc librespot[3593]: ERROR:librespot_playback::audio_backend::alsa: Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_buffer_size_near' failed with error 'EINVAL: Invalid argument'
May 04 09:55:20 osmc librespot[3593]: ERROR:librespot_playback::player: Could not start audio: Alsa error: PCM open failed
May 04 09:55:25 osmc librespot[3593]: ERROR:librespot_playback::audio_backend::alsa: Alsa error PCM open ALSA function 'snd_pcm_hw_params_set_buffer_size_near' failed with error 'EINVAL: Invalid argument'
May 04 09:55:25 osmc librespot[3593]: ERROR:librespot_playback::player: Could not start audio: Alsa error: PCM open failed
root@osmc:/home/osmc#
#107

Any progress on this. Have the same problem and same error message since the april update? Had no problem with the gmc’s nightlies and the Vero4k!

Cheers

#108

If I start playing music on my computer or iPad and then connect to the Raspotify device then the music always plays fine over the Raspotify. But if I connect to the Raspotify first and then try to start a track then it doesn’t play at all. I have to disconnect from Raspotify, start the track then reconnect. It’s been like that for several months for me (also on GMC nightlies).

#109

Unfortunately the error remains. I already reinstalled raspotify 2 times but still no luck.

#110

For what it’s worth, here’s the output of systemctl status raspotifyfrom my Vero playing Spotify successfully:

systemctl status raspotify
* raspotify.service - Raspotify
   Loaded: loaded (/lib/systemd/system/raspotify.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-05-06 20:48:58 CEST; 22h ago
  Process: 967 ExecStartPre=/bin/chown raspotify:raspotify /var/cache/raspotify (code=exited, status=0/SUCCESS)
  Process: 964 ExecStartPre=/bin/mkdir -m 0755 -p /var/cache/raspotify (code=exited, status=0/SUCCESS)
 Main PID: 970 (librespot)
   CGroup: /system.slice/raspotify.service
           `-970 /usr/bin/librespot --name raspotify (osmc) --backend alsa --bitrate 320 --disable-audio-cache --linear-volume --initial-volume=100 --device hw:1,0

May 07 18:47:51 osmc librespot[970]: INFO:librespot_playback::player: Loading track "Love For Sale" with Spotify URI "spotify:track:3OjnbuH3wCUY91l61e3wLl"
May 07 18:47:52 osmc librespot[970]: INFO:librespot_playback::player: Track "Love For Sale" loaded
May 07 18:56:42 osmc librespot[970]: INFO:librespot_playback::player: Loading track "Love For Sale" with Spotify URI "spotify:track:3OjnbuH3wCUY91l61e3wLl"
May 07 18:56:43 osmc librespot[970]: INFO:librespot_playback::player: Track "Love For Sale" loaded

A couple of things I notice is that I don’t have volume normalization active and I have the device name (hw:1,0) in the command. I’ve no idea whether that makes any difference …

#111

I‘ve tested your settings but I get still errors and no sound. Perhaps I try a fresh install…

#112

Hmm. I’m out of ideas, sorry.

#113

this could help

#114

I’m getting the exact same issue since I did the April update on my Vero4K. I tried changing almost all the settings in the raspotify file with no good result.

One thing that fixes the problem is installing pulseaudio
sudo apt-get install pulseaudio
sudo systemctl restart raspotify.service

BUT, then the sound in OSMC is broken… So I removed pulseaudio again.

This is a big issue for me as I find the Kodi Add-on from Marcelveldt is not really functional using Spotify connect.

I think some library update coming with the April update broke something raspotify/librespot is using. If there is a solution using pulseaudio with osmc it would be ok for me for the time being…

#115

There’ve been a few reports re. the Spotify add-on being problematic.

Do you have a link / more details about this?

Sam

#116

well, what I am sure of is that the raspotify service was working pretty nicely until I did the upgrade in April.
I should add that yesterday I did some manual dist-upgrade while trying to fix the issue…

But it looks like something with accessing the sound card changed, or at least that is what the error message seems to hint to.

Is there a way to downgrade so that I could check if this fixes the issue? I’m happy to help narrow the issue down, as I’m really pleased with the vero4k and osmc!

#117

I think that may be a red herring. I’ve been using the nightlies all along and the April upgrade made no difference to my ability to use Raspotify on Vero2k. Still works fine here. However, at some time in January/February (i.e. long before the April update) I lost the ability to start something playing while connected to Raspotify. But if I disconnect, start the track playing on my laptop/tablet and then reconnect, it plays fine until the end of the playlist.

I’m using the async USB output to a USB DAC (MiniDSP 2x4 HD) if that has any bearing on the result (I doubt it).

#118

Ok, so I’ve gone through a bunch of testing, and the conclusion is:

  • nothing bad in OSMC updates (sorry for this), I went 2 versions back
    -> The problem comes actually from raspotify itself or of its components. Going back to version 0.12 solved the issue and it works perfectly again, hurray!

Opened an issue over there

#119

Yes. That did it for me as well. Thank you very much!!!