Convert Figma logo to code with AI

dtcooper logoraspotify

A Spotify Connect client that mostly Just Works™

4,641
215
4,641
7

Top Related Projects

Open Source Spotify client library

Synchronous multiroom audio player

Linux/FreeBSD DAAP (iTunes) and MPD audio server with support for AirPlay 1 and 2 speakers (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.

A spotify daemon

Adblocker for Spotify

Quick Overview

Raspotify is an open-source project that turns a Raspberry Pi into a Spotify Connect device. It allows you to stream Spotify music directly to your Raspberry Pi, which can be connected to speakers or audio systems, effectively creating a DIY Spotify-enabled smart speaker.

Pros

  • Easy installation process with a one-line command
  • Supports various Raspberry Pi models and architectures
  • Integrates seamlessly with existing Spotify ecosystem
  • Regularly updated and maintained by the community

Cons

  • Requires a Spotify Premium account to function
  • Limited to Spotify streaming only, not suitable for other music services
  • May require additional configuration for optimal audio output
  • Dependent on stable internet connection for streaming

Getting Started

To install Raspotify on your Raspberry Pi, follow these steps:

  1. Ensure your Raspberry Pi is running Raspbian or a compatible OS.
  2. Open a terminal and run the following command:
curl -sL https://dtcooper.github.io/raspotify/install.sh | sh
  1. Once installed, reboot your Raspberry Pi:
sudo reboot
  1. After rebooting, your Raspberry Pi should appear as a Spotify Connect device in the Spotify app on your phone or computer.

For advanced configuration options, you can edit the /etc/raspotify/conf file:

sudo nano /etc/raspotify/conf

Customize settings like device name, bitrate, and audio output device as needed.

Competitor Comparisons

Open Source Spotify client library

Pros of librespot

  • More actively maintained with frequent updates and bug fixes
  • Offers a wider range of features and customization options
  • Supports multiple audio backends (ALSA, PulseAudio, PortAudio)

Cons of librespot

  • Requires more technical knowledge to set up and configure
  • Less user-friendly documentation for beginners
  • May have higher resource usage on low-powered devices

Code Comparison

librespot:

let (mut player, credentials) = Player::new(config, session.clone(), audio_setup, move |_| {});
player.load(SpotifyId::from_uri("spotify:track:0GiWi4EkPXM0HLWuCiZOom").unwrap(), true, 0);
player.play();

raspotify:

sudo apt-get -y install curl && curl -sL https://dtcooper.github.io/raspotify/install.sh | sh

Summary

Librespot is a more flexible and feature-rich Spotify client library, offering greater customization and active development. However, it requires more technical expertise to implement. Raspotify, built on librespot, provides an easier installation process and is more beginner-friendly, but with fewer customization options. The choice between the two depends on the user's technical skills and specific requirements for their Spotify streaming setup.

Synchronous multiroom audio player

Pros of Snapcast

  • Multi-room audio synchronization: Snapcast allows for synchronized playback across multiple devices, creating a seamless multi-room audio experience.
  • Flexible audio sources: Supports various audio sources, including Spotify, MPD, and custom streams, offering more versatility than Raspotify's Spotify-only focus.
  • Cross-platform compatibility: Works on multiple platforms, including Linux, macOS, and Windows, providing broader device support.

Cons of Snapcast

  • More complex setup: Requires configuration of both server and client components, which can be more challenging for beginners compared to Raspotify's simpler installation.
  • Higher resource usage: May consume more system resources due to its multi-room synchronization features, potentially impacting performance on low-powered devices.

Code Comparison

Snapcast (server configuration):

{
  "streams": [
    {
      "name": "Spotify",
      "uri": "spotify:///librespot?name=Spotify&devicename=Snapcast&bitrate=320"
    }
  ]
}

Raspotify (configuration):

OPTIONS="--username <USERNAME> --password <PASSWORD> --device-name Raspotify"
BITRATE="320"

Both projects offer audio streaming capabilities, but Snapcast provides more advanced features for multi-room setups, while Raspotify focuses on a simpler, Spotify-specific solution. The code examples show the different approaches to configuration, with Snapcast using a JSON format and Raspotify using environment variables.

Linux/FreeBSD DAAP (iTunes) and MPD audio server with support for AirPlay 1 and 2 speakers (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.

Pros of OwnTone

  • Supports multiple audio sources beyond Spotify, including local files and internet radio
  • Offers more advanced audio features like gapless playback and ReplayGain
  • Provides a web interface for remote control and management

Cons of OwnTone

  • More complex setup and configuration process
  • Requires more system resources due to its broader feature set
  • May have a steeper learning curve for users new to media servers

Code Comparison

OwnTone configuration example:

general:
  uid: "owntone"
  db_path: "/var/cache/owntone/songs3.db"
  logfile: "/var/log/owntone.log"

library:
  name: "My Music Library"
  port: 3689

audio:
  type: "alsa"
  card: "default"

Raspotify configuration example:

DEVICE_NAME="My Spotify Connect Device"
BITRATE="320"
CACHE_ARGS="--disable-audio-cache"
VOLUME_ARGS="--enable-volume-normalisation --linear-volume --initial-volume=100"

The code comparison shows that OwnTone uses a YAML-based configuration file with more detailed options, while Raspotify uses a simpler bash-style configuration with environment variables. This reflects the difference in complexity and feature sets between the two projects.

A spotify daemon

Pros of Spotifyd

  • Written in Rust, offering better performance and memory safety
  • Supports a wider range of audio backends (ALSA, PulseAudio, PortAudio)
  • More actively maintained with frequent updates and bug fixes

Cons of Spotifyd

  • Requires compilation from source, which can be more complex for some users
  • May have higher system requirements due to Rust runtime

Code Comparison

Spotifyd (Rust):

let (mut stream, creds) = Session::connect(session_config, credentials, true, start_loading_cb).await?;

Raspotify (Shell script):

librespot \
  --name "$DEVICE_NAME" \
  --backend alsa \
  --bitrate 320 \
  --cache "$CACHE_ARGS" \
  --enable-volume-normalisation

Key Differences

  • Raspotify is a shell script wrapper around librespot, while Spotifyd is a standalone Rust application
  • Spotifyd offers more customization options and flexibility
  • Raspotify is easier to install and set up, especially on Raspberry Pi devices
  • Spotifyd may have better long-term prospects due to its active development and use of Rust

Use Cases

  • Raspotify: Ideal for quick setup on Raspberry Pi devices with minimal configuration
  • Spotifyd: Better for users who need advanced features, cross-platform support, or prefer a native Rust application

Adblocker for Spotify

Pros of spotify-adblock

  • Blocks ads in the Spotify desktop application
  • Works on Linux systems
  • Lightweight and easy to install

Cons of spotify-adblock

  • Limited to desktop use, not applicable for Raspberry Pi or other devices
  • May require more frequent updates to keep up with Spotify changes
  • Potential legal concerns due to ad-blocking functionality

Code Comparison

spotify-adblock:

static const char *blacklist[] = {
    "https://spclient.wg.spotify.com/ads/",
    "https://spclient.wg.spotify.com/ad-logic/",
    "https://spclient.wg.spotify.com/gabo-receiver-service/",
};

Raspotify:

ExecStart=/usr/bin/librespot --name ${DEVICE_NAME} --backend alsa --device ${DEVICE_NAME} --bitrate 320 --cache /var/cache/raspotify --enable-volume-normalisation --linear-volume --initial-volume=${INITIAL_VOLUME}

Key Differences

  1. Purpose: spotify-adblock focuses on blocking ads in the desktop app, while Raspotify enables Spotify playback on Raspberry Pi devices.
  2. Platform: spotify-adblock is for Linux desktops, Raspotify is for Raspberry Pi and similar devices.
  3. Functionality: spotify-adblock modifies the Spotify client behavior, Raspotify acts as a Spotify Connect receiver.
  4. Implementation: spotify-adblock uses C for ad-blocking logic, Raspotify uses shell scripts and Rust (librespot) for playback.

Both projects serve different needs in the Spotify ecosystem, with spotify-adblock enhancing the desktop experience and Raspotify extending Spotify's reach to IoT devices.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

:warning: :warning: :warning: NOTE: I have limited to no time to work on this package these days!

I am looking for a maintainer to help with issues and updating the package. Please reach out via email at david@jew.pizza if you have interest in helping.

Cheers,

David

Raspotify is a Debian package and associated repository for Debian Stable ( Currently Debian 11 "Bullseye" ) and other Debian Stable based/compatible OS's ( your mileage may vary ) which thinly wraps a fork of the awesome librespot library by Paul Lietar and others up as a systemd daemon.

Raspotify is intended to be used in a headless enviroment. For desktop OS's spotifyd offers similar functionality and is a better choice. If you're looking for a turnkey audio solution for Raspberry Pi's with Spotify Connect support we recommend moOde™ audio player.

Librespot, and therefore Raspotify, requires a premium account.

Installation

There are various "guides" floating around online. Most if not all of them are outdated and/or present incorrect information. Don't follow them.

sudo apt-get -y install curl && curl -sL https://dtcooper.github.io/raspotify/install.sh | sh

Or you can just download the latest .deb package and install it manually from here:

Raspotify does NOT support ARMv6 Pi's (Pi v1 and Pi Zero v1.x)

Configuration

The wiki is full of useful information. The Basic Setup Guide is a good place to start.

Bug Reports, Questions and Feature Requests

Please read the Troubleshooting Guide, the Basic Setup Guide, and search though open and closed issues and discussions before opening an issue or asking a question.

Disclaimer

Per librespot's disclaimer, using librespot — the underlying library behind raspotify — to connect to Spotify's API "is probably forbidden by them." We've not received word about that, however use at your own risk.

Raspotify and librespot are intended for personal private use. Please DO NOT use Raspotify or librespot in any sort of commercial and/or public presentation. Doing so is a flagrant violation of Spotify's terms of service and could potentially lead to them blocking all Raspotify and librespot users.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Special thanks to Paul Lietar, librespot org and its many contributors for librespot, which Raspotify packages (a slightly modded version of). Without librespot, Raspotify would simply not exist.

📻 "And Now, For Something Completely Different!" 🎙️

Raspotify's author David Cooper has abandoned being a software engineer to pursue a career as a radio personality. If you find Raspotify useful, you can support him by checking out his radio work here or give him a follow on Twitter.

On a related note, @JasonLG1979 has become the de-facto maintainer of the project. So an additional thank you to him as well.

If you'd like to buy Jason a Red Bull you can ❤️ Sponsor Him.

Final Note

...and remember kids, have fun!