mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 00:05:55 +03:00
[GH-ISSUE #835] Sound is distorted when using Rodio on Alsa #421
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#421
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @stargazer on GitHub (Aug 12, 2021).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/835
Originally assigned to: @roderickvd on GitHub.
i have librespot set up on a raspberry pi 3 with HiFiberry.
All of a sudden, the sound has become very distorted and noisy, making it essentially unlistenable. It's almost like listening to a very scratched and badly produced vinyl.
The exact build i'm running is
librespot 0.2.0 d65f504 (Built on 2021-08-05, Build ID: g5mmH7Vl).I run
librespotwith these parameters:I've also tried a few different switches like
--volume-ctrl linear,--enable-volume-normalisation,--normalisation-pregain, but the sound is still the same.Here's some logs
Thanks in advance :)
@roderickvd commented on GitHub (Aug 12, 2021):
I think the logs you posted were launched with different parameters? I see normalisation is enabled, but that's not in your command line above.
--normalisation-method basic?The issue sounds like #745 but that should only apply when using the 0.2.0 crate as a library, and that's not your case is it?
@stargazer commented on GitHub (Aug 12, 2021):
Hi @roderickvd and thanks for the prompt reply!
This is the exact service that starts
librespot. As you can see the command line options are the ones I posted earlier.Just tried it and indeed, the sound is still very distorted
I compile from source. This is the exact way.
Shall I use the source code from the
devbranch? Currently I'm running the executable after compiling the tarball from release 0.2.0No I use the
librespotexecutable.Here is another instance of the logs, using the aforementioned service to start librespot
-- Logs begin at Thu 2021-08-12 06:32:56 EDT. --
Aug 12 06:33:30 moode systemd[1]: Started Librespot service..
Aug 12 06:33:30 moode librespot[492]: [2021-08-12T10:33:30Z INFO librespot] librespot 0.2.0 d65f504 (Built on 2021-08-05, Build ID: g5mmH7Vl)
Aug 12 06:33:30 moode librespot[492]: [2021-08-12T10:33:30Z DEBUG librespot_connect::discovery] Zeroconf server listening on 0.0.0.0:37459
Aug 12 06:44:59 moode librespot[492]: [2021-08-12T10:44:59Z DEBUG librespot_connect::discovery] POST "/" {}
Aug 12 06:44:59 moode librespot[492]: [2021-08-12T10:44:59Z INFO librespot_core::session] Connecting to AP "gew1-accesspoint-a-5kvs.ap.spotify.com:4070"
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z INFO librespot_core::session] Authenticated as "" !
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_core::session] new Session[0]
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_connect::spirc] new Spirc[0]
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_connect::spirc] canonical_username:
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_playback::player] new Player[0]
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_core::mercury] new MercuryManager
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z INFO librespot_playback::audio_backend::rodio] Using Rodio sink with format S16 and cpal host: ALSA
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z INFO librespot_playback::audio_backend::rodio] Using audio device: default
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_connect::spirc] input volume:65535 to mixer: 65535
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_core::session] Session[0] strong=3 weak=2
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z INFO librespot_core::session] Country: "CY"
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_core::mercury] subscribed uri=hm://remote/user// count=0
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_playback::audio_backend::rodio] Rodio sink was created
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_playback::player] command=AddEventSender
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_playback::player] command=VolumeSet(65535)
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_connect::spirc] kMessageTypeNotify "zenbook2" eb6fb28818088d5353749a91b2503b32e32ddc92 972495842 1628765100268 kPlayStatusStop
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_connect::spirc] kMessageTypeLoad "zenbook2" eb6fb28818088d5353749a91b2503b32e32ddc92 972495999 1628765100268 kPlayStatusPause
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_connect::spirc] State: context_uri: "spotify:album:6GB9bBNGojMgArV4PiSPbS" index: 2 position_ms: 68907 status: kPlayStatusPause position_measured_at: 1628765100507 context_description: "" shuffle: false repeat: false playing_from_fallback: true row: 0 playing_track_index: 2 track {gid: "K\262+'ohJ\306\262;\020\245\034\253\267{"} track {gid: "\n\355p\376\312\270J\220\204\246M\222\nk{\237"} track {gid: "\333\314T\000+\rJ\307\214Y+\007s\035R\327"} track {gid: "y\007)\357\3261E\310\213#0\320\250\360X\302"} track {gid: "\n\323\366_#qDY\230\266\365&\334\251\251\373"} track {gid: "\355\002c\327\263\277M3\206\327\272\346\272\371V2"} track {gid: "\217\2700>\013tH\327\267L$\364\272\311\302\270"} track {gid: "@d3w\2454I]\230\262\2571\266^'7"} track {gid: "F7\204\326\017\024B\355\257\320\252\302i\246\232~"} track {gid: "O\007\252\360\255\253G,\247\241\223=\253\227\273\362"} track {gid: "E\026\220\020\022\247M\370\221\245D\242Tl\035\237"}
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_connect::spirc] Frame has 11 tracks
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPause]
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_playback::player] command=Load(SpotifyId { id: 292161863371768312336577371927280964311, audio_type: Track }, false, 68907)
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPause]
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z INFO librespot_playback::player] Loading with Spotify URI spotify:track:6GKHgrk3Z2XAiwnIVgBqSz
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_audio::fetch] Downloading file aae8f777ae27acb890093a32c9d2dcbe849153e8
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_core::channel] new ChannelManager
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z DEBUG librespot_core::audio_key] new AudioKeyManager
Aug 12 06:45:00 moode librespot[492]: [2021-08-12T10:45:00Z TRACE librespot_audio::fetch::receive] Ping time estimated as: 89 ms.
Aug 12 06:45:01 moode librespot[492]: [2021-08-12T10:45:01Z DEBUG librespot_playback::player] Normalisation Data: NormalisationData { track_gain_db: -7.989998, track_peak: 1.0248911, album_gain_db: -7.2699966, album_peak: 1.0315394 }
Aug 12 06:45:01 moode librespot[492]: [2021-08-12T10:45:01Z DEBUG librespot_playback::player] Normalisation Type: Album
Aug 12 06:45:01 moode librespot[492]: [2021-08-12T10:45:01Z DEBUG librespot_playback::player] Normalisation Threshold: -1.0
Aug 12 06:45:01 moode librespot[492]: [2021-08-12T10:45:01Z DEBUG librespot_playback::player] Normalisation Method: Dynamic
Aug 12 06:45:01 moode librespot[492]: [2021-08-12T10:45:01Z DEBUG librespot_playback::player] Normalisation Factor: 0.43301225
Aug 12 06:45:01 moode librespot[492]: [2021-08-12T10:45:01Z DEBUG librespot_playback::player] Normalisation Attack: 0.005
Aug 12 06:45:01 moode librespot[492]: [2021-08-12T10:45:01Z DEBUG librespot_playback::player] Normalisation Release: 0.1
Aug 12 06:45:01 moode librespot[492]: [2021-08-12T10:45:01Z DEBUG librespot_playback::player] Normalisation Knee: 1.0
Aug 12 06:45:01 moode librespot[492]: [2021-08-12T10:45:01Z TRACE librespot_audio::fetch::receive] Ping time estimated as: 87 ms.
Aug 12 06:45:01 moode librespot[492]: [2021-08-12T10:45:01Z TRACE librespot_audio::fetch::receive] Ping time estimated as: 87 ms.
Aug 12 06:45:01 moode librespot[492]: [2021-08-12T10:45:01Z TRACE librespot_audio::fetch::receive] Ping time estimated as: 87 ms.
Aug 12 06:45:01 moode librespot[492]: [2021-08-12T10:45:01Z TRACE librespot_audio::fetch::receive] Ping time estimated as: 89 ms.
Aug 12 06:45:01 moode librespot[492]: [2021-08-12T10:45:01Z TRACE librespot_audio::fetch::receive] Ping time estimated as: 86 ms.
Aug 12 06:45:02 moode librespot[492]: [2021-08-12T10:45:02Z TRACE librespot_audio::fetch::receive] Ping time estimated as: 96 ms.
Aug 12 06:45:02 moode librespot[492]: [2021-08-12T10:45:02Z TRACE librespot_audio::fetch::receive] Ping time estimated as: 94 ms.
Aug 12 06:45:02 moode librespot[492]: [2021-08-12T10:45:02Z TRACE librespot_audio::fetch::receive] Ping time estimated as: 86 ms.
Aug 12 06:45:02 moode librespot[492]: [2021-08-12T10:45:02Z TRACE librespot_audio::fetch::receive] Ping time estimated as: 83 ms.
Aug 12 06:45:02 moode librespot[492]: [2021-08-12T10:45:02Z INFO librespot_playback::player] (221600 ms) loaded
Aug 12 06:45:02 moode librespot[492]: [2021-08-12T10:45:02Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPause]
Aug 12 06:45:02 moode librespot[492]: [2021-08-12T10:45:02Z TRACE librespot_connect::spirc] ==> kPlayStatusPause
Aug 12 06:45:02 moode librespot[492]: [2021-08-12T10:45:02Z TRACE librespot_audio::fetch::receive] Ping time estimated as: 86 ms.
Aug 12 06:45:11 moode librespot[492]: [2021-08-12T10:45:11Z DEBUG librespot_connect::spirc] kMessageTypePlay "zenbook2" eb6fb28818088d5353749a91b2503b32e32ddc92 972507015 1628765102461 kPlayStatusPause
Aug 12 06:45:11 moode librespot[492]: [2021-08-12T10:45:11Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPlay]
Aug 12 06:45:11 moode librespot[492]: [2021-08-12T10:45:11Z DEBUG librespot_playback::player] command=Play
Aug 12 06:45:11 moode librespot[492]: [2021-08-12T10:45:11Z TRACE librespot_playback::player] == Starting sink ==
Aug 12 06:45:11 moode librespot[492]: [2021-08-12T10:45:11Z TRACE librespot_connect::spirc] ==> kPlayStatusPlay
Aug 12 06:45:11 moode librespot[492]: [2021-08-12T10:45:11Z TRACE librespot_connect::spirc] ==> kPlayStatusPlay
Aug 12 06:45:12 moode librespot[492]: [2021-08-12T10:45:12Z DEBUG librespot_connect::spirc] kMessageTypePause "zenbook2" eb6fb28818088d5353749a91b2503b32e32ddc92 972507962 1628765111625 kPlayStatusPlay
Aug 12 06:45:12 moode librespot[492]: [2021-08-12T10:45:12Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPause]
Aug 12 06:45:12 moode librespot[492]: [2021-08-12T10:45:12Z DEBUG librespot_playback::player] command=Pause
Aug 12 06:45:12 moode librespot[492]: [2021-08-12T10:45:12Z TRACE librespot_playback::player] == Stopping sink ==
Aug 12 06:45:12 moode librespot[492]: [2021-08-12T10:45:12Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPause]
Aug 12 06:45:12 moode librespot[492]: [2021-08-12T10:45:12Z TRACE librespot_connect::spirc] ==> kPlayStatusPause
Aug 12 06:45:15 moode librespot[492]: [2021-08-12T10:45:15Z DEBUG librespot_connect::spirc] kMessageTypePlay "zenbook2" eb6fb28818088d5353749a91b2503b32e32ddc92 972510797 1628765112625 kPlayStatusPause
Aug 12 06:45:15 moode librespot[492]: [2021-08-12T10:45:15Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPlay]
Aug 12 06:45:15 moode librespot[492]: [2021-08-12T10:45:15Z DEBUG librespot_playback::player] command=Play
Aug 12 06:45:15 moode librespot[492]: [2021-08-12T10:45:15Z TRACE librespot_playback::player] == Starting sink ==
Aug 12 06:45:15 moode librespot[492]: [2021-08-12T10:45:15Z TRACE librespot_connect::spirc] ==> kPlayStatusPlay
Aug 12 06:45:15 moode librespot[492]: [2021-08-12T10:45:15Z TRACE librespot_connect::spirc] ==> kPlayStatusPlay
Aug 12 06:45:15 moode librespot[492]: [2021-08-12T10:45:15Z DEBUG librespot_connect::spirc] kMessageTypeVolume "zenbook2" eb6fb28818088d5353749a91b2503b32e32ddc92 972511465 1628765115448 kPlayStatusStop
Aug 12 06:45:15 moode librespot[492]: [2021-08-12T10:45:15Z DEBUG librespot_connect::spirc] input volume:18321 to mixer: 452
Aug 12 06:45:15 moode librespot[492]: [2021-08-12T10:45:15Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPlay]
Aug 12 06:45:15 moode librespot[492]: [2021-08-12T10:45:15Z DEBUG librespot_playback::player] command=VolumeSet(18321)
Aug 12 06:45:17 moode librespot[492]: [2021-08-12T10:45:17Z DEBUG librespot_connect::spirc] kMessageTypeVolume "zenbook2" eb6fb28818088d5353749a91b2503b32e32ddc92 972512729 1628765116065 kPlayStatusStop
Aug 12 06:45:17 moode librespot[492]: [2021-08-12T10:45:17Z DEBUG librespot_connect::spirc] input volume:35938 to mixer: 2895
Aug 12 06:45:17 moode librespot[492]: [2021-08-12T10:45:17Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPlay]
Aug 12 06:45:17 moode librespot[492]: [2021-08-12T10:45:17Z DEBUG librespot_playback::player] command=VolumeSet(35938)
Aug 12 06:45:18 moode librespot[492]: [2021-08-12T10:45:18Z DEBUG librespot_connect::spirc] kMessageTypeVolume "zenbook2" eb6fb28818088d5353749a91b2503b32e32ddc92 972513923 1628765117364 kPlayStatusStop
Aug 12 06:45:18 moode librespot[492]: [2021-08-12T10:45:18Z DEBUG librespot_connect::spirc] input volume:50736 to mixer: 13775
Aug 12 06:45:18 moode librespot[492]: [2021-08-12T10:45:18Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPlay]
Aug 12 06:45:18 moode librespot[492]: [2021-08-12T10:45:18Z DEBUG librespot_playback::player] command=VolumeSet(50736)
Aug 12 06:45:19 moode librespot[492]: [2021-08-12T10:45:19Z DEBUG librespot_connect::spirc] kMessageTypeVolume "zenbook2" eb6fb28818088d5353749a91b2503b32e32ddc92 972515129 1628765118491 kPlayStatusStop
Aug 12 06:45:19 moode librespot[492]: [2021-08-12T10:45:19Z DEBUG librespot_connect::spirc] input volume:52146 to mixer: 15982
Aug 12 06:45:19 moode librespot[492]: [2021-08-12T10:45:19Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPlay]
Aug 12 06:45:19 moode librespot[492]: [2021-08-12T10:45:19Z DEBUG librespot_playback::player] command=VolumeSet(52146)
Aug 12 06:45:19 moode librespot[492]: [2021-08-12T10:45:19Z DEBUG librespot_connect::spirc] kMessageTypeVolume "zenbook2" eb6fb28818088d5353749a91b2503b32e32ddc92 972515476 1628765118491 kPlayStatusStop
Aug 12 06:45:19 moode librespot[492]: [2021-08-12T10:45:19Z DEBUG librespot_connect::spirc] input volume:65535 to mixer: 65535
Aug 12 06:45:19 moode librespot[492]: [2021-08-12T10:45:19Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPlay]
Aug 12 06:45:19 moode librespot[492]: [2021-08-12T10:45:19Z DEBUG librespot_playback::player] command=VolumeSet(65535)
Aug 12 06:45:20 moode librespot[492]: [2021-08-12T10:45:20Z DEBUG librespot_connect::spirc] kMessageTypePause "zenbook2" eb6fb28818088d5353749a91b2503b32e32ddc92 972516207 1628765120080 kPlayStatusPlay
Aug 12 06:45:20 moode librespot[492]: [2021-08-12T10:45:20Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPause]
Aug 12 06:45:20 moode librespot[492]: [2021-08-12T10:45:20Z DEBUG librespot_playback::player] command=Pause
Aug 12 06:45:20 moode librespot[492]: [2021-08-12T10:45:20Z TRACE librespot_playback::player] == Stopping sink ==
Aug 12 06:45:20 moode librespot[492]: [2021-08-12T10:45:20Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPause]
Aug 12 06:45:20 moode librespot[492]: [2021-08-12T10:45:20Z TRACE librespot_connect::spirc] ==> kPlayStatusPause
Thanks again @roderickvd :)
@roderickvd commented on GitHub (Aug 12, 2021):
Yes please try compiling from
dev.@stargazer commented on GitHub (Aug 12, 2021):
Hi @roderickvd, I have compiled from
devas you suggested. The sound is still distorted, same as before.Here are some logs from this run
@roderickvd commented on GitHub (Aug 12, 2021):
--backend alsadirectly instead of using Rodio?I cannot reproduce this, I'm starting to think it's something in your OS or sound system configuration.
@stargazer commented on GitHub (Aug 12, 2021):
Nothing, not on my end at least. I've had the same
librespotbuild for quite a few months now, and my raspberry pi was running it non-stop for a couple of months. Then one day the sound was distorted and noisy.I get this beauty :/
log
The thing is, I also run Moode on the same machine so that I can playback my own music library as well. That one does work beautifully and the sound is as good as ever.
@stargazer commented on GitHub (Aug 12, 2021):
Perhaps related:
@roderickvd commented on GitHub (Aug 12, 2021):
Yes, please compile like
cargo build --release --features alsa-backend.Co-incidentally, that's also what moOde does, so this may turn out to be a Rodio thing.
@stargazer commented on GitHub (Aug 12, 2021):
oh wow @roderickvd, just tried it and this has absolutely fixed the sound. Crystal clear, like it used to be :)
I have absolutely no idea what
alsais, why it wasn't available and how it differs from Rodio, but thanks a bunch for your help :)@roderickvd commented on GitHub (Aug 12, 2021):
Happy to help. This is a thing with Rodio on Alsa, that sometimes happens and sometimes doesn't. Earlier I spent some time debugging in Rodio and CPAL but haven't found a clue as to why. You should report it upstream if you can.