Issues with Spotify device connection from Picroft

I’ve just got my Picroft up and running and now I’m trying to connect Spotify. I’ve added the Spotify skill and configured the username and password. When I ask Mycroft to play something, it plays through a Spotify device (my Amazon Echo, my iPhone etc). Now I want to set up a Spotify device on the RPi itself. I installed raspotify, and updated my /etc/default/raspotify with the same name as my Picroft device (which I simply called “Picroft” on home.mycroft.ai).

Device name on Spotify Connect

DEVICE_NAME=“Picroft”

I edited the device in the skill settings to match, and this is reflected in ~/mycroft-core/skills/mycroft-spotify.forslund/settings.json:

{“default_device”: “Picroft”, “Spotify”: “1”, “use_ducking”: true, “user”: “i0p7j6t0aipmxiptpeb87l2lj”, “__mycroft_skill_firstrun”: false, “password”: “REDACTED”}

If I open the Spotify app on my phone, it says that devices are available and I can choose Picroft. The sound does come out of my RPi, but it’s really slowed down like the sample rate is incorrect. Also, if I try to play anything using Mycroft, I get the following error message:

Unable to get a default device while trying to play something

If anybody could help set this up I would really appreciate it!

I just rebooted and tried again, and this time Mycroft told me verbally that:

Spotify couldn’t start playback: I couldn’t find any Spotify devices"

But when I opened the Spotify app on my phone, the device was showing there as available and I could stream to it (albeit with the apparent sample rate issue). When I then stopped playback from the phone and asked Mycroft to play something, it played through Raspotify. But I don’t understand why I needed to play something using the phone client first.

Hmm, further problems. If I quit the Spotify app from my phone and ask Mycroft to play something, it says it is playing, but I don’t hear anything. When I re-open the Spotify app on my phone, it says it is playing what I asked for to Picroft. If I switch the device to play it to the phone then it continues playing and I can hear it from the phone. If I then switch it to the Picroft device using the phone app, the sound comes from the Picroft.

Hey mashers, thanks for the reports.

I just tried firing up Spotify on a Picroft and had similar results. It’s working fine on the Mark 1’s but for me the Picroft won’t show as a potential Spotify device.

One of our key developers Ake is currently looking at the Spotify Skill as we’ve also seen a few bugs cropping up. Ake’s on leave this week but I’ll flag this thread with him when he gets back.

Thanks gez. I think part of the problem might actually be with raspotify, as I’ve seen some bug reports on the raspotify GitHub page from others having similar issues. I tried switching over from raspotify to spocon, which is a wrapper for a Java Spotify device endpoint. It does work, but not on Stretch as the openjdk-11-jre package doesn’t exist on Stretch. I actually installed Buster and set up Mycroft manually and was able to get spocon working, but it still wasn’t very reliable :confused:

@mashers You can try spotifyd, there is an arm version that appears to run fine on my rp4.

@lordsiris thank you for the suggestion but unfortunately I have the same problem with that as I had with raspotify - the audio is stretched out like the sample rate is incorrect :confused:

@lordsiris - Oh wait, I switched the system to use the output of my ReSpeaker instead of the built-in Pi output and it works perfectly! Thank you! :slight_smile: :slight_smile: :slight_smile:

Hm it still doesn’t work from Mycroft, only if I stream to spotifyd directly from my phone

Does the spotifyd config have the name of your mycroft device? Also think you will have much better audio output in general using the respeaker output vs the internal pi headphone (those are notoriously bad quality).

I try more than 8 hours to bring it to run and I had several problems.

My first problem has something to do with my family-spotify-account. I try a single spotify account and this worked always without issues. Here is a open bug report for this.

I setup raspotify first without my spotify credentials but then I realized that the spotify-skill just worked when my account is connected on any device. So the the simple solution to this was to enable the credentials in raspotify.

Is there any reason why the skill does not install raspotify, spotifyd or spocon by itself, while installing the skill. Like a requirement?

Greetings by suisat