MRA4: Installing Librespot

This post goes about installing Librespot. This player will be connected to Snapcast. If you want to use it with Snapcast, read part 2 about installing it.

Download and install

Librespot needs to be installed from source. The following steps need to be done:

    • On the page of Snapcast, they ask to build Librespot in /usr/local/bin. So we should move to this location.
    • Clone from GitHub.
    • Instal some dependencies
    • Build Librespot (This can take a while)
    • Make the file executable
    • Copy the file to the asked folder, so the Snapserver can find it.
$ cd /usr/local/bin/
$ sudo wget
$ sudo unzip
$ cd librespot-master/
$ sudo apt-get install build-essential portaudio19-dev
$ sudo cargo build --release
$ sudo chmod +x target/release/librespot
$ cd ..
$ sudo cp librespot-master/target/release/librespot librespot

Sometimes, cargo is not installed. Install it with the following command:

$ sudo apt-get install cargo

Add Librespot to Snapcast

Now we can add the Librespot instance to the configuration of the Snapserver. This can be done by adding the following line:

-s "spotify:///librespot?name=Spotify[&username=<myusername>&password=<mypassword>][&devicename=Snapcast][&bitrate=320][&onstart=<start_command>][&onstop=<stop_command>][&volume=<volume_

Every part in [ ] is an optional part. If you use a part in these brackets, the parts in the < > are required. In my setup, I only added the device name because this name will be visible in Home Assistant. The name of the pipe is the name you will see in the Spotify app. As you can see in the screenshot of the configuration of Snapcast, I made two Librespot players. So now, my girlfriend has her own speaker and I have mine. In Home assistant, we can choose our source for the specific speaker.

Leave a Reply

Your email address will not be published. Required fields are marked *