Skip to content
Jason Gray edited this page May 31, 2021 · 52 revisions
Type Short Long Description Hint
Option h help Print a list of options and flags.
Option V version Display a librespot version string.
Option c cache Path to a directory where files will be cached. CACHE
Option system-cache Path to a directory where system files (credentials, volume) will be cached. Can be different from cache option value. SYSTEM_CACHE
Option cache-size-limit Limits the size of the cache for audio files. It's possible to use suffixes like K, M or G. CACHE_SIZE_LIMIT
Flag disable-audio-cache Disable caching of the audio data.
Option n name Device name NAME
Option device-type The displayed device type in Spotify clients. Can be unknown, computer, tablet, smartphone, speaker, tv, avr (Audio/Video Receiver), stb (Set-Top Box), and audiodongle. Defaults to speaker DEVICE_TYPE
Option b bitrate Bitrate (96, 160 or 320). Defaults to 160 BITRATE
Option onevent The path to a script that gets run when one of librespot's events is triggered. PROGRAM
Flag emit-sink-events Run program set by onevent before sink is opened and after it is closed.
Flag v verbose Enable verbose output PROGRAM
Option u username Username to sign in with USERNAME
Option p password Password PASSWORD
Flag disable-discovery Disable discovery mode
Option backend Audio backend to use. Use '?' to list options BACKEND
Option device Audio device to use. Use '?' to list options (Only with the rodio/portaudio/alsa backends) DEVICE
Option format Output format (F64 ,F32, S32, S24, S24_3 or S16). Defaults to S16 FORMAT
Option dither Specify the dither algorithm to use - [none , gpdf , tpdf , tpdf_hp ]. Defaults to tpdf for formats S16 , S24 , S24_3 and none for other formats. DITHER
Option mixer Mixer to use (softvol/alsa) MIXER
Option mixer-name alsa mixer name e.g PCM or Master. Defaults to PCM MIXER_NAME
Option mixer-card alsa mixer card, e.g hw:0 or similar from aplay -l. Defaults to default MIXER_CARD
Option mixer-index alsa mixer index, Index of the cards mixer. Defaults to 0 MIXER_INDEX
Option initial-volume Initial volume in %, once connected [0-100] VOLUME
Flag enable-volume-normalisation Enables volume normalisation for librespot
Option normalisation-method Specify the normalisation method to use - [basic, dynamic]. Default is dynamic. NORMALISATION_METHOD
Option normalisation-gain-type Specify the normalisation gain type to use - [track, album]. Default is album. GAIN_TYPE
Option normalisation-pregain A numeric value for pregain (dB). Only used when normalisation active. PREGAIN
Option normalisation-threshold Threshold (dBFS) to prevent clipping. Default is -1.0. THRESHOLD
Option normalisation-attack Attack time (ms) in which the dynamic limiter is reducing gain. Default is 5. ATTACK
Option normalisation-release Release or decay time (ms) in which the dynamic limiter is restoring gain. Default is 100. RELEASE
Option normalisation-knee Knee steepness of the dynamic limiter. Default is 1.0. KNEE
Option volume-ctrl [linear, log, fixed] Choose between a logarithmic (default), linear, or fixed (no volume control) volume scaling.
Flag disable-gapless Disables gapless playback by forcing the sink to close b/w tracks
Flag autoplay Autoplay similar songs when your music ends
Option zeroconf-port The port that the HTTP server advertised on zeroconf will use [1-65535]. Ports <= 1024 may require root priviledges.
Option proxy Use a proxy for resolving the access point. Proxy should be an HTTP proxy in the form http://ip:port, and can also be passed using the all-lowercase http_proxy environment variable.
Option ap-port Connect to AP with specified port. If no AP with that port are present fallback AP will be used. Available ports are usually 80, 443 and 4070. PORT
Option passthrough output raw Ogg data to stdout (needs pipe backend)

Volume normalisation

librespot supports ReplayGain volume normalisation, with the ReplayGain values provided by Spotify in the Ogg streams. As of librespot 0.2.0, there are two types of volume normalisation methods available:

Basic

The volume is increased or decreased as per the average ReplayGain of that track or its album. If that would result in peaks over a certain threshold (hard-coded at 0 dBFS for librespot up to 0.1.6; -1 dBFS and configurable as of librespot 0.2.0), then the volume increase is limited so that the peak is exactly 0 dBFS. This gain is fixed for the entire duration of the track.

This is the only limiter available in librespot up to 0.1.6.

Dynamic

(as of librespot 0.2.0)

Again the volume is increased or decreased as per the average ReplayGain of that track or its album. However, if this now results in peaks over the threshold (-1 dBFS by default), the gain is dynamically reduced for the duration of that peak, then recovered to the original target gain. This length of the attack and release for this reduction and recovery from zero to full effect by default mimic the Spotify client, and are configurable.

During the attack and release period, the rate of change from zero to full effect (the "knee") has a configurable steepness. By default this is 1.0, which means a linear slope. Values above 1.0 yield softer knees with a more gentle start and end but steeper rate of change mid-way. Values below 1.0 start and stop more sharply, and are flatter in between. Values of 0.0 and below first give an impulse response, then invert the limiter, and should not be used.

The equivalent librespot options to match the volume normalisation settings in official Spotify clients are:

Loud

--enable-volume-normalisation --normalisation-pregain 6

Normal (Default)

--enable-volume-normalisation --normalisation-pregain 3

Quiet

--enable-volume-normalisation --normalisation-pregain -5

Output format

librespot up to 0.1.6 always outputs 16-bit samples, except for JACK Audio where it converts to 32-bit output after volume control.

As of librespot 0.2.0, the audio output is still 16-bit by default, but can be configured to output 32-bit floating point (F32), 32-bit integer (S32), 24-bit PCM in a 32-bit word (S24) or 24-bit integer packed as three bytes (S24_3). Software volume control and normalisation is done before sample conversion, so that there is no loss of dynamic range.

Clone this wiki locally