mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 00:05:55 +03:00
[PR #1662] chore: Add ability to change player sample rate #1482
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#1482
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?
📋 Pull Request Information
Original PR: https://github.com/librespot-org/librespot/pull/1662
Author: @SapiensAnatis
Created: 12/19/2025
Status: 🔄 Open
Base:
dev← Head:feature/local-files-resample📝 Commits (3)
8782b79chore: Add ability to change player sample rate892522efeat: Skip track on failed sample rate changes1480a22docs: Add changelog entry📊 Changes
13 files changed (+157 additions, -36 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
playback/src/audio_backend/alsa.rs(+33 -19)📝
playback/src/audio_backend/gstreamer.rs(+4 -0)📝
playback/src/audio_backend/jackaudio.rs(+4 -0)📝
playback/src/audio_backend/mod.rs(+5 -0)📝
playback/src/audio_backend/pipe.rs(+4 -0)📝
playback/src/audio_backend/portaudio.rs(+4 -0)📝
playback/src/audio_backend/pulseaudio.rs(+4 -0)📝
playback/src/audio_backend/rodio.rs(+4 -0)📝
playback/src/audio_backend/sdl.rs(+4 -0)📝
playback/src/audio_backend/subprocess.rs(+4 -0)📝
playback/src/decoder/symphonia_decoder.rs(+10 -15)📝
playback/src/player.rs(+76 -2)📄 Description
Adds the ability for the player to change its sample rate, to be able to accurately play back local files that aren't sampled at 44.1 kHz.
The functionality to change sample rate must be implemented individually by each sink. In this PR, I have only implemented support in the ALSA sink. I wanted to get some feedback on the general approach before I went and updated + tested every single sink. I may not actually be able to do every sink myself depending on if some of them have particular hardware/software requirements.
Testing this by swapping between a 48.0 kHz local file and a 44.1 kHz Spotify song appears to play back both without any distortion of sound.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.