Outils pour utilisateurs

Outils du site


Turn your Raspberry Pi into a Spotify remote device

Intro

I'm using the spotify daemon from a little while and now I feel that is stable enough to deserve to write down some cookbook notes for future use and to share them.

So in this article we will install a Spotify daemon on a Raspberry Pi, then you will be able to tell your Spotify client from which device you want to listen to your music.

What you need

  • A Spotify premium account (I didn't tried with a standard account though).
  • A Raspberry PI connected to internet (for me it's a Raspberry Pi 3 with Raspbian 9 (stretch)).
  • A Spotify client (Desktop, Web, mobile).
  • Some speakers connected to the Raspberry. (I'm using something like these).

Resources

This article shows the steps I made following the readme file of the official Spotify daemon project on Github, you're encouraged to check it for further informations/questions/issues.

Simple installation

You want to pick up the last release for arm here, at the time of writing the last realease is the 0.2.11 and the archive is spotifyd-2019-06-19-armv6.zip.

So ssh or just open a terminale on your raspi and then:

  $ mkdir spotify
  $ cd spotify
  $ wget https://github.com/Spotifyd/spotifyd/releases/download/0.2.11/spotifyd-2019-06-19-armv6.zip
  $ unzip ./spotifyd-2019-06-19-armv6.zip
  $ ./spotifyd

And that's all you need.

Spotify Client

If all went well you should see now a blue dot on the devices icon. Depending on your client of choice the position and the color could be different.

Mine look like this:

Click on the icon and select Spotifyd

Wait a few seconds…

… any sound?

If yes Congratulations! You made it.

If no … well try to troubleshoot in the next section or go to the advanced configuration.

Troubleshooting

  • Check all the connections (the speakers for example)
  • Pump up the volume (thanks Erik !) :
  $ alsamixer
  • Sound check:
  $ speaker-test -t wav -c 6

Still no sound? The problem is not caused from spotifyd (hardware maybe?).

Advanced Configuration

With the new releases of Spotifyd comes a lots of configuration options. Here we will give a name at our demon and then autoload it with systemd.

Name your daemon

  $ mkdir -p ~/.config/spotifyd
  $ nano ~/.config/spotifyd/spotifyd.conf

Write these lines in the spotifyd config file:

  [global]
  device_name = awesome_spotify_device

You can put what name you want in place of awesome_spotify_device but spaces are not admitted.

If you have trouble connecting you can try to put your spotify credential in the same file, like:

  [global]
  device_name = awesome_spotify_device
  username = awesome_ptl_member
  password = not_so_secret_password

Now restart spotifyd.

Autolaunch

  $ mkdir -p ~/.config/systemd/user
  $ cd ~/.config/systemd/user
  $ wget https://raw.githubusercontent.com/Spotifyd/spotifyd/master/contrib/spotifyd.service
  $ nano ./spotifyd.service
  

In the [Service] section change the path of the spotifyd executable to match yours. For example:

  ...
  [Service]
  ExecStart=/home/pi/spotify/spotifyd --no-daemon
  ...

Check if there is a Spotifyd process already running and if is the case kill it.

Finally:

  $ systemctl --user start spotifyd.service
  $ systemctl --user enable spotifyd.service
  $ systemctl --user status spotifyd.service
projects/dev/spotify_raspberry.txt · Dernière modification: 2019/06/24 20:09 par pliski