Hi everyone!
I wanted to share how I set up my Raspberry Pi2 to run a Spotify Connect music player on Volumio 2, with audio output through an external USB sound card. This way, you can play music from Spotify while controlling it from the standard Spotify app on your PC, Mac, phone or tablet.
There’s nothing novel below, just thought it might be nice to have it all together in a single place to make it easy for anyone wanting to do it.
Here’s what I did:
-
(Optional) As I already had Raspbian running on my Pi2, I took a backup using the gzip version of this answer http://raspberrypi.stackexchange.com/a/312.
-
I then installed Volumio by following https://volumio.org/get-started
-
(Optional) As I use my P2 with an external USB sound card, I need to set up Alsa correctly. The first step is to figure out which card number the USB sound card is. You can do this by running
cat /proc/asound/cards
where the card number is the one furthest to the left of the device you want to use. Take note of this.
As Volumio does not come with any Alsa configuration file, we first need to create and then open it:
sudo touch /etc/asound.conf
sudo nano /etc/asound.conf
Then put the following in the asound.conf file, save and close it. Please note that my card number is “5”, yours might be different.
pcm.!default {
type hw
card 5
}
ctl.!default {
type hw
card 5
}
- Then install and start Spotify Connect as shown here https://github.com/Fornoth/spotify-connect-web
That’s really all there is to it! I’ve seen tutorials claiming there’s a lot more to it to get the Spotify Connect part working, but if your asound.conf file is correctly set up, this should do it!
If you want Spotify Connect to start automatically on startup, here’s how. It idles at 0.3% CPU usage and 2.9% Mem usage, so it should be fine to just keep running.
Create an auto_start script somewhere, for instance “spotify_auto_start.sh” and make it look like this (obviously replace with your own username and password):
#!/bin/sh
cd /home/volumio/spotify-connect-web
./spotify-connect-web --name Volumio --username <yourUserName> --password <yourPassword> --bitrate 320 & > /dev/null 2>&1
cd -
Make the script executable:
chmod ugo+x spotify_auto_start.sh
Add the following to /etc/rc.local:
<path_to_your_script.sh> || exit 1
exit 0
And your done!