explaingit

librespot-org/librespot

6,780RustAudience · developerComplexity · 3/5Setup · moderate

TLDR

librespot is a Rust library that lets developers build custom Spotify Connect receivers, so any device or app can appear as a Spotify speaker without relying on Spotify's discontinued official library.

Mindmap

mindmap
  root((librespot))
    What it does
      Spotify Connect receiver
      Custom device building
      Audio streaming
    Audio Backends
      ALSA on Linux
      PulseAudio
      GStreamer
      JACK and SDL
    Platform Support
      macOS and Windows
      Linux
      Raspberry Pi
    Community Projects
      Spotifyd background service
      ncspot terminal player
      raspotify Pi setup
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Turn a Raspberry Pi into a Spotify speaker that appears in the Spotify app as a named Connect device.

USE CASE 2

Build a terminal-based or headless Spotify player that streams audio to any supported audio backend.

USE CASE 3

Integrate Spotify Connect playback into a custom home automation or media server project.

Tech stack

RustCargoALSAPulseAudioGStreamer

Getting it running

Difficulty · moderate Time to first run · 30min

Requires a Spotify Premium account, Linux users must install audio library packages before building.

In plain English

librespot is an open source Rust library that lets applications play music from Spotify and act as a Spotify Connect receiver. Spotify Connect is the feature that allows you to choose which device plays music from within the Spotify app, the way you might send audio from your phone to a smart speaker. With librespot, developers can build custom devices or software that appear as Spotify speakers without relying on Spotify's official, now discontinued, closed-source library. The library only works with Spotify Premium accounts, and the maintainers have stated they will not add support for free-tier features such as ads or skipping limits. To use it, you install it via Cargo, Rust's package manager, with a single command. Once running, it creates a named receiver that shows up in the Spotify app alongside any other Spotify Connect devices you own. You can set the audio bitrate, initial volume, volume normalization, and how the device appears in the app. Credentials and cached audio data are stored locally for repeat use. On macOS and Windows, building requires no extra steps. On Linux, a small number of audio library packages need to be installed first. The library supports many audio output backends, including ALSA, PulseAudio, GStreamer, PortAudio, JACK, and SDL, so it fits into a wide range of Linux audio setups. Pre-built packages are also available through official package managers on Linux, FreeBSD, and NetBSD. Several community projects build on librespot: Spotifyd turns it into a lightweight background service, ncspot wraps it in a terminal-based Spotify player, and raspotify makes it straightforward to set up a Raspberry Pi as a Spotify speaker.

Copy-paste prompts

Prompt 1
Show me how to install librespot on a Raspberry Pi running Linux and configure it as a named Spotify Connect device.
Prompt 2
Write a librespot configuration that sets audio bitrate to 320kbps, enables volume normalization, and uses PulseAudio as the output backend.
Prompt 3
How do I set up librespot with Spotifyd to run as a background service that restarts automatically on boot?
Prompt 4
Configure librespot on a headless Linux server to appear as a Spotify speaker with a custom device name and fixed initial volume.
Prompt 5
Build a minimal Rust app using librespot that authenticates with Spotify Premium and plays a playlist through ALSA.
Open on GitHub → Explain another repo

← librespot-org on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.