Streaming Spotify from my Raspberry Pi
After Repurposing my RaspberryPi using PI Hole I wondered if there was an easier way to play my music from Spotify.
We were using an android tablet connected with a jack plug to play Spotify. Sometimes however the tablet is in use and we can’t play music. We have a ChromeCast but I don’t want to have to turn on the TV whenever I want to listen to music. And our HiFi set is an old fashioned one without HDMI inputs on the receiver otherwise the ChromeCast solution would probably work very well.
So I started looking into options for the RPi or my Synology NAS and what Spotify would support as streaming options. The obvious onces were AirPlay or DLNA and there is a pimusicbox which does all this and more but was a bit heavy for my taste. PI music box is an OS and having just installed Raspbian with PI Hole I wasn’t going to discard all that work for a Spotify player.
After some google searches I stumbled on Raspotify which implements the Spotify Connect api and presents itself to Spotify as a speaker. The installation steps seemed too easy to not give it a try. Similar to installing PI Hole this was also a oneliner:
curl -sL https://dtcooper.github.io/raspotify/install.sh | sh
After the installation completed my RPi appeared in the list of playback devices in my Spotify app. That was easy! I plugged in the jack cable in the RPi and started playing a song but I heard no sound. Since the RPi was connected to my TV (it used to be a Kodi media player) I turned on the TV and noticed it was using the HDMI audio as output. A simple command to select the audio jack as output did the trick:
amixer cset numid=3 1
And we’re done! I can now play songs from any device from wherever in my house :)