Skip to content
Jason Gray edited this page Mar 16, 2023 · 36 revisions

Crashes and Restarts

The Raspotify service is set to restart after a 10 sec delay if librespot crashes for whatever reason but to avoid an infinite restart loop in the event of misconfiguration or other percipient issues that would spam the systemd logs and could eventually fill up your hard drive (or sd card in the case of a Pi) Raspotify also rate limits those restarts. If the service is restarted more than 5 times in 60 secs it will not auto-restart.

A report for the most recent crash will be located at /etc/raspotify/crash_report.

It can be viewed with sudo cat /etc/raspotify/crash_report.

And as always you can see the full logs with sudo journalctl -u raspotify -b.

Updating from older versions/install issues

I just updated Raspotify and now none of my settings from /etc/default/raspotify work anymore?

Version 0.31.4 introduces breaking changes to the Raspotify Package. Please see the wiki for details.

I've installed Raspotify on a Raspberry Pi v1/Raspberry Pi Zero v1.x and it just keeps crashing?

Support for ARMv6 (Pi v1 and Pi Zero v1.x) has been dropped, as mentioned in the README.

I'm trying to update or install and apt tells me that I have unmet dependencies?

As per the README Raspotify only supports Debian Stable and other Debian Stable based/compatible OS's. You're more than likely running an out of date OS version.

Volume issues

My volume on Spotify is 100% and it's still too quiet?

Have you tried turning the volume up using the command alsamixer?

Getting Raspotify to use the sound device of your choice

My Raspberry Pi does not use my sound card/device!

See The Basic Setup Guide.

Bit-perfect?

I'm an audiophile and I want bit-perfect output?

Well, sorry... Spotify doesn't stream lossless audio currently.

To get as close as possible we're going to need to know what format(s) your DAC supports.

Wait, isn't the audio 16 bit 44.1 khz?

Well, it started out that way but lossy audio doesn't have a bit depth.

The decoder outputs 32 bit float 44.1 khz PCM and all digital processing in librespot is done in 64 bit float to be as lossless as possible.

That PCM has to be re-quantized back into an integer format for playback on most DACs.

The higher the bit depth the lower the quantization noise.

See The Basic Setup Guide.

If you want to get really crazy you can disable volume normalization and volume control and set the initial volume to 100 to approximate bit-perfect as much as possible by uncommenting:

# Initial volume in % from 0 - 100.
# Defaults to 50 For the alsa mixer: the current volume.
#LIBRESPOT_INITIAL_VOLUME="50"

# Volume control scale type {cubic|fixed|linear|log}.
# Defaults to log.
#LIBRESPOT_VOLUME_CTRL="log"

And changing it to:

# Initial volume in % from 0 - 100.
# Defaults to 50 For the alsa mixer: the current volume.
LIBRESPOT_INITIAL_VOLUME="100"

# Volume control scale type {cubic|fixed|linear|log}.
# Defaults to log.
LIBRESPOT_VOLUME_CTRL="fixed"

Hardware volume control

How do I use/enable hardware volume control in librespot?

The short answer is, you don't if you care about fidelity.

Unless you need some kind of advanced ALSA feature that requires you to use hardware volume control don't use it.

Software volume control in librespot in done with 64 bit floating point precision and is objectively better than any and all forms of hardware volume control.

Pipes and fifo

I'm using the pipe backend with snapcast / a fifo and the raspotify systemd service keeps crashing!

The intention of the raspotify service is to output directly to a sound device not to pipe to a file or fifo. As such the provided service file uses best practices to limit the access that the raspotify service has to various system directories as much as possible which makes it very difficult to use librespot's pipe backend with the raspotify service. Issues related to piping to a file or fifo will be closed as invalid as they are out of scope of the intentions of Raspotify.

In the case of snapcast it's probably easier to disable the Raspotify service and just use the provided librespot binary directly from snapcast. In that case the burden of support shifts to snapcast. All issues related to snapcast and the librespot binary shipped with Raspotify will also be closed as invalid.

onevent scripts

My onevent script doesn't work, what gives?

The provided raspotify service file uses best practices to limit the access that the raspotify service has to various system directories as much as possible. Much like the pipe backend use case that means that onevent scripts are not very useful as they are extremely limited in what they can actually do (basically nothing).

If you wish to use onevent scripts with librespot you will need to "roll your own" service file, at which point you will no longer be using Raspotify. All issues related to modified or custom service files will be closed as invalid as they are out of scope of the intentions of Raspotify.

Spotify credentials

I put my Spotify username and password in /etc/raspotify/conf and now I get a bunch of nag emails from Spotify?

Unless you have disable zeroconf (mDNS) discovery, librespot does not need your Spotify credentials, zeroconf with take care of authentication.

However if you have disabled discovery for whatever reason and you provided your credentials you will also want to enable credential caching so that librespot will cache the auth token and not have to login every time you connect. Unless you like nag emails ofc?

To enable credential caching change this in /etc/raspotify/conf:

# Disable caching of credentials.
# Caching of credentials is not necessary so long as
# LIBRESPOT_DISABLE_DISCOVERY is not set.
LIBRESPOT_DISABLE_CREDENTIAL_CACHE=

To this:

# Disable caching of credentials.
# Caching of credentials is not necessary so long as
# LIBRESPOT_DISABLE_DISCOVERY is not set.
# LIBRESPOT_DISABLE_CREDENTIAL_CACHE=

Random Disconnects/Restarts

If librespot stops playing at random moments as if you had pressed the "stop" button, look for ECONNRESET errors in your logs. librespot is not yet able to recover from transient connection errors to the Spotify servers automatically.

Other issues

File an issue, and if we get it sorted, I'll add to this list.

With the exception of fixing typos please do NOT edit this or any other Wiki page without at least opening a discussion.