Streaming Spotify

I was wondering if this could also be used to play Spotify. I saw the example for the Demo video. To play it on a Sonos speaker, but i was wondering if there was an easier solution to just play a spotify album on the box.

You can use this function to stream any audio ffmpeg can decode. So if you have a solution that provides a playlist or something similar that ffmpeg can work with, it will work with teddyCloud.

You can. I set it up this way:

  • Raspberry Pi 3B+ (you need at least a RPi2) with
    • latest Raspberry Pi OS
    • spotifyd
    • butt (“Broadcast Using This Tool”)
    • xvfb (to run butt headless)
    • pulseaudio
    • icecast2
    • spotify-tui (optional, for control via CLI)

It was a hassle to set it up at first, but now it works like a charm. Expect a delay of 5-30s because of encoding, decoding and buffering.

Maybe I’ll post a tutorial in the coming days/weeks

1 Like

I try to explain the “chain” a bit:

  • spotifyd as client plays audio
  • butt receives the audio and streams it to
  • icecast2 which streams it to the network

Since butt is built for using “graphical” it’s easiest to set it up first in desktop view and afterwards launch it headless with xvfb-run butt &

I set everything up as systemd services to launch at boot without logging in.
Regarding security, it’s maybe not the safest method, but I’m only in my local network, so what shrug

1 Like

@baumeisterde I have more or less the same setup, and more or less the same problems. One way around it could be to turn around the connection (would need a new feature in teddy). So if teddycloud would use ffplay to essentially listen to UDP, and the Spotifyd would stream to teddycloud specifically, it shouldn’t have the delay and the chain would be “shorter”. I still have to test and verify if my thoughts add up or not.

This is a great idea. But this would need some logic more logic on the teddyCloud side.

  • If there is no connection from the box, save 5s of the stream in RAM and drop it to the hdd as soon as the box asks
  • If the box is connected, but there is no data left to send, send “silence”.
  • It also makes sense to break the connection to the box, if the tonie is removed for a longer period of time. (What happens? Does the box play an error message?

Why not opening an issue on GitHub and discuss this idea?

3 Likes

I have created an issue on GitHub Streaming Spotify playlist #137

2 Likes