Remote Control of Spotify on Linux
This article may be of interest to you if you happen to have a Linux computer attached to your sound system and you also use Spotify. If you’re streaming music to your sound system from your phone through bluetooth, as I was until recently, you might find the method I describe here to be preferable. I will explain how to set up a Spotify remote server on your Linux machine and control it from your Spotify client. You’ll get better sound quality without any bluetooth annoyances. The server is free software and interfaces automatically with any official Spotify client if you have a premium account.
This will work for you if you have:
- A sound system.
- A Linux machine, connected to your WiFi, with the sound output feeding an input of your sound system. (Your Linux must use systemd: Debian-based distributions work.)
- A Spotify premium membership.
- A Spotify client that you use on your Wifi-connected phone, tablet, etc.
How Your Life Will Improve
- Sound quality: many phones use a bluetooth codec that audibly limits the sound quality.
- Eliminate bluetooth hassles: distance between phone and sound system becomes irrelevant; not using bluetooth means not dealing with pairing annoyances; bluetooth sometimes stutters or drops out.
- Your next amplifier need not be bluetooth equipped; or, you can eliminate your bluetooth interface.
How to Install
curl -sL https://dtcooper.github.io/raspotify/install.sh | sh
will download the Spotify remote daemon and install and start it up as a systemd service. That’s all you need to do! If you’re the suspicious type, you can download the install script and cast your critical eye over it first (probably good advice in general).
The developer’s page lists some requirements for the thing to run. They are fairly recent versions of some libraries, but it turned out I already had all of them installed on my server, which is running Debian 11.
You also get a configuration file in
/etc/raspotify/conf. I made one change to this, setting
LIBRESPOT_BITRATE="320". You need not set any credentials, because the Spotify client authenticates you. However, your Linux machine and the client need to be on the same WiFi network.
How to Use
Turn the knobs and push the buttons so that your sound system is energized and accepting audio from your server machine.
On the Spotify app on your phone or what have you, look for the icon like the one indicated here with a crude red arrow. When you tap this logo, you’ll be taken to a screen with a list of your “devices”. One (most likely the only) entry on the list should look like
raspotify (machine), where
machine is your server’s network name. Select that, and play your music: it should be emanating from your sound system.
My amplifier talks bluetooth, and until a few weeks ago I was using that with Spotify. I like the method described here much better. I already had a little Linux computer hooked up to my sound system, so this was easy to try. I am aware that there is no sadder arena of self-deception that that in which breathless golden-ear types convince themselves that they can hear differences that they most definitely do not hear. Nevertheless, the improvement in clarity when switching from bluetooth to remote control with direct audio out to the amplifier was pretty obvious (I use an outboard D to A converter between the computer and the amp). This might be because my phone is a few years old and doesn’t have the latest bluetooth codecs; you might not experience as dramatic a sonic improvement. I actually don’t know if increasing the bitrate to 320 makes a difference that I can hear, because I didn’t test it; but it does no harm that I am aware of.
Eliminating the usual bluetooth annoyances is also a big advantage. After you use the Spotify app to start the music playing, the remote server acts independently until you give it another instruction. This means that you can receive calls on your phone, take it out of range, or even turn it off (I suppose) and Spotify will continue going through your playlist or subjecting you to its weird music choices without your intervention. It also means that you might want to ensure that you’ve stopped the music from the app when you want the music to stop.