Announcements

Help Wizard

Step 1

NEXT STEP

[Linux] Different sample rate and resolution between Alsa and PulseAudio audio driver

[Linux] Different sample rate and resolution between Alsa and PulseAudio audio driver

Spotify Premium and Arch Linux user here. Spotify v1.0.59.395. Outputdevice: AudioQuest DragonFly v1.5 DAC. It supports the four sample rates 44100, 48000, 88200 and 96000 Hz.

 

If PulseAudio is running when Spotify is started, it automatically switches to the PulseAudio backend; if there's no PulseAudio, it uses direct Alsa output. This can be seen when spotify is started in the console with the --show-console option:

spotify --show-console 2>&1 | grep audio_driver
14:49:41.718 I [audio_driver_linux.cpp:26       ] Using Alsa

Now here's what I observe:

  • PulseAudio always receives a 16 bit 44.1 kHz stream from the Spotify application, even if high quality audio is set in the preferences. My PulseAudio would happily pass an unaltered 24 bit 48 kHz stream to my DAC, since my PA's alternate frequency is set to 48 kHz (and it operates in 24 bit, my DAC's native resolution).
  • Alsa always receives a 24 bit 48 kHz stream, which it can directly pass to my DAC.

I find it unfortunate that the lower-quality settings seem to be hardcoded into the Spotify audio driver's PulseAudio mode, no matter what high-quality audio stream is played. Obviously, the Alsa backend uses higher-quality settings.

 

It is also interesting to mention that even switching off high-quality streaming, PA still receives a 16/44.1 stream and Alsa still a 24/48 stream. So it seems that also the audio driver's alsa settings are hardcoded, but to higher-quality ones. I thought I read somewhere that Spotify's normal-quality streams use a sample rate of 44.1 kHz. Concluding, with PA playback, Spotify either downsamples (high-quality streaming) or sends the audio unaltered (normal-quality streaming); with Alsa playback, Spotify sends high-quality streaming unaltered and upsamples normal-quality streaming. Is that correct?

 

It would be great if Spotify always sended a non up/down-sampled stream to any backend and let the backend do the resampling, if necessary at all. Also, please always print the current track's native sample rate in spotify's debugging output.

 

Thanks, Sebastian

Reply
0 Replies

Suggested posts