librespot-org / librespot

Open Source Spotify client library
MIT License
4.48k stars 542 forks source link

Librespot with pulseaudio setup #1199

Closed SummerSeaSun closed 7 months ago

SummerSeaSun commented 10 months ago

To reproduce Steps to reproduce the behavior:

  1. check available audio devices: librespot --backend pulseaudio --device ?
[2023-08-30T08:33:56Z INFO  librespot] librespot 0.4.2 a6e1258 (Built on 2023-06-21, Build ID: zuwVQKTQ, Profile: release)
[2023-08-30T08:33:56Z INFO  librespot_playback::audio_backend::pulseaudio] Using PulseAudioSink with format: S16, sample rate: 44100
  1. start librespot with selected device: librespot ---verbose -backend pulseaudio --device PulseAudioSink

  2. connect from open.spotify trow this error: 2023-08-30T08:38:31Z ERROR librespot_playback::player] Audio Sink Error Connection Refused: <PulseAudioSink> Connection refused

Log A full log so we may trace your problem (launch librespot with --verbose). Format the log as code.


 [2023-08-30T08:48:06Z DEBUG librespot_connect::spirc] kMessageTypeNotify "Web Player (Chrome)" a8315c5c2bc2f578b56dececbf8ee0693afa3573 116817>
 [2023-08-30T08:48:06Z DEBUG librespot_core::mercury] subscribed uri=hm://remote/user/aaaaaaaaaaaaaaaaaa/ count=0
 [2023-08-30T08:48:06Z INFO  librespot_core::session] Country: "IT"
 [2023-08-30T08:48:06Z DEBUG librespot_core::session] Session[0] strong=3 weak=2
 [2023-08-30T08:48:06Z DEBUG librespot_playback::player] command=VolumeSet(62139)
 [2023-08-30T08:48:06Z DEBUG librespot_playback::player] command=AddEventSender
 [2023-08-30T08:48:06Z DEBUG librespot_playback::normaliser] Normalisation Release: 100 ms
 [2023-08-30T08:48:06Z DEBUG librespot_playback::mixer::mappings] Input volume 62139 mapped to: 69.91%
 [2023-08-30T08:48:06Z DEBUG librespot_playback::normaliser] Normalisation Attack: 5 ms
 [2023-08-30T08:48:06Z DEBUG librespot_playback::normaliser] Normalisation Method: Dynamic
 [2023-08-30T08:48:06Z DEBUG librespot_playback::normaliser] Normalisation Threshold: -2.0 dBFS
 [2023-08-30T08:48:06Z DEBUG librespot_playback::normaliser] Normalisation Pregain: 0.0 dB
 [2023-08-30T08:48:06Z DEBUG librespot_playback::normaliser] Normalisation Type: Auto
 [2023-08-30T08:48:06Z DEBUG librespot_playback::resampler] No <ResampleWorker> threads required
 [2023-08-30T08:48:06Z DEBUG librespot_playback::resampler] Interpolation Type: Bypass
 [2023-08-30T08:48:06Z DEBUG librespot_playback::resampler] Sample Rate: 44.1kHz
 [2023-08-30T08:48:06Z INFO  librespot_playback::audio_backend::pulseaudio] Using PulseAudioSink with format: S32, sample rate: 44100
 [2023-08-30T08:48:06Z DEBUG librespot::component] new MercuryManager
 [2023-08-30T08:48:06Z DEBUG librespot_connect::spirc] canonical_username: aaaaaaaaaaaaaaaaaaaaaa
 [2023-08-30T08:48:06Z DEBUG librespot_connect::spirc] new Spirc[0]
 [2023-08-30T08:48:06Z DEBUG librespot_playback::player] Created <PlayerInternal> [player:0] thread
 [2023-08-30T08:48:06Z INFO  librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0)
 [2023-08-30T08:48:06Z DEBUG librespot_core::session] new Session[0]
 [2023-08-30T08:48:06Z INFO  librespot_core::session] Authenticated as "asaaaaaaaaaaaaa" !
 [2023-08-30T08:48:05Z INFO  librespot_core::session] Connecting to AP "ap-guc3.spotify.com:4070"
 [2023-08-30T08:48:05Z WARN  librespot_core::apresolve] Ignoring blacklisted access point ap-gue1.spotify.com:80
 [2023-08-30T08:48:05Z WARN  librespot_core::apresolve] Ignoring blacklisted access point ap-gew4.spotify.com:80
 [2023-08-30T08:48:05Z WARN  librespot_core::apresolve] Ignoring blacklisted access point ap-gew4.spotify.com:443
 [2023-08-30T08:48:05Z WARN  librespot_core::apresolve] Ignoring blacklisted access point ap-gew4.spotify.com:4070
 [2023-08-30T08:48:05Z DEBUG librespot_discovery::server] Shutting down discovery server
 [2023-08-30T08:48:05Z DEBUG librespot_discovery::server] Zeroconf server listening on 0.0.0.0:45065
 [2023-08-30T08:48:05Z TRACE librespot]                 LIBRESPOT_DEVICE="127.0.0.1"
 [2023-08-30T08:48:05Z TRACE librespot]                 LIBRESPOT_PASSWORD="XXXXXXXX"
 [2023-08-30T08:48:05Z TRACE librespot]                 LIBRESPOT_USERNAME="XXXXXXXX"
 [2023-08-30T08:48:05Z TRACE librespot]                 LIBRESPOT_DEVICE_TYPE="avr"
 [2023-08-30T08:48:05Z TRACE librespot]                 LIBRESPOT_FORMAT="S32"
 [2023-08-30T08:48:05Z TRACE librespot]                 LIBRESPOT_BITRATE="320"
 [2023-08-30T08:48:05Z TRACE librespot]                 LIBRESPOT_VERBOSE="on"
 [2023-08-30T08:48:05Z TRACE librespot]                 LIBRESPOT_ENABLE_VOLUME_NORMALISATION="on"
 [2023-08-30T08:48:05Z TRACE librespot]                 LIBRESPOT_DISABLE_CREDENTIAL_CACHE="off"
 [2023-08-30T08:48:05Z TRACE librespot]                 LIBRESPOT_DISABLE_AUDIO_CACHE="on"

Host (what you are running librespot on):

Additional context I've followed this for mpd https://askubuntu.com/questions/555103/mpd-with-pulseaudio and that works fine. If I use alsa instead librespot works fine.

kingosticks commented 10 months ago

That doesn't look like a full log, it doesn't even contain your error message.

Considering the link you posted, why not try running PULSE_SERVER=127.0.0.1 librespot ---verbose --backend pulseaudio

roderickvd commented 7 months ago

No response, closing.