[PR #1180] Add Resampling Support #1266

Open
opened 2026-02-27 20:01:47 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/1180
Author: @JasonLG1979
Created: 6/22/2023
Status: 🔄 Open

Base: devHead: resampling


📝 Commits (10+)

  • 0cefd0e Better thread handling in player
  • 35b94bd Add the ability to get backend latency
  • 7dae33c Use default macro
  • 71660a2 Add InterpolationQuality and SampleRate enums
  • 3b64f25 Add resampler
  • 375f837 Add normaliser
  • 9861a58 Add sample_pipeline
  • 3bcf549 Convert get_latency_pcm to get_latency_ms in sample_pipeline
  • e1ea400 Change the backends so that they support the diffrent sample rates
  • efec96b Put it all together

📊 Changes

38 files changed (+3445 additions, -942 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 Cargo.toml (+8 -2)
📝 connect/Cargo.toml (+1 -1)
📝 connect/src/spirc.rs (+1 -1)
📝 core/Cargo.toml (+4 -4)
📝 core/src/session.rs (+14 -2)
📝 core/src/spclient.rs (+14 -4)
📝 discovery/Cargo.toml (+1 -1)
📝 examples/play.rs (+2 -1)
📝 examples/play_connect.rs (+2 -1)
📝 playback/Cargo.toml (+1 -1)
📝 playback/src/audio_backend/alsa.rs (+328 -331)
📝 playback/src/audio_backend/gstreamer.rs (+10 -4)
📝 playback/src/audio_backend/jackaudio.rs (+14 -6)
📝 playback/src/audio_backend/mod.rs (+11 -4)
📝 playback/src/audio_backend/pipe.rs (+14 -8)
📝 playback/src/audio_backend/portaudio.rs (+46 -26)
📝 playback/src/audio_backend/pulseaudio.rs (+66 -43)
📝 playback/src/audio_backend/rodio.rs (+31 -18)
📝 playback/src/audio_backend/sdl.rs (+15 -9)

...and 18 more files

📄 Description

This PR adds resampling to 48kHz, 88.2kHz, and 96kHz with Windowed Sinc Interpolation.

It also moves everything except decoding out of player and a few other misc improvements like improving thread creation in player, using #[default] in the player config enums where we can, and includes the sample pipeline latency in calculating an accurate position.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/librespot-org/librespot/pull/1180 **Author:** [@JasonLG1979](https://github.com/JasonLG1979) **Created:** 6/22/2023 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `resampling` --- ### 📝 Commits (10+) - [`0cefd0e`](https://github.com/librespot-org/librespot/commit/0cefd0ea668ab1cdba28ec364ac92703eefdeb17) Better thread handling in player - [`35b94bd`](https://github.com/librespot-org/librespot/commit/35b94bdc9467f312dac0e2244f8b5806f98132e7) Add the ability to get backend latency - [`7dae33c`](https://github.com/librespot-org/librespot/commit/7dae33c4f0c6eaaab32c3ce1d05fb0ac50110b2c) Use default macro - [`71660a2`](https://github.com/librespot-org/librespot/commit/71660a23515967ad973873c538aff9fe4cfc9056) Add InterpolationQuality and SampleRate enums - [`3b64f25`](https://github.com/librespot-org/librespot/commit/3b64f2528641dae97ef2f25f917c3cb40264dee2) Add resampler - [`375f837`](https://github.com/librespot-org/librespot/commit/375f83797a5211d11b3342cbb2e36a086d6e5ef8) Add normaliser - [`9861a58`](https://github.com/librespot-org/librespot/commit/9861a582a6d3710f2e2eb3cd1c8ad6b066b091e2) Add sample_pipeline - [`3bcf549`](https://github.com/librespot-org/librespot/commit/3bcf5498d2267880f7a857c37965b5759561d8d4) Convert get_latency_pcm to get_latency_ms in sample_pipeline - [`e1ea400`](https://github.com/librespot-org/librespot/commit/e1ea400220e1ad3d0f859ab5d51292ada625cfaf) Change the backends so that they support the diffrent sample rates - [`efec96b`](https://github.com/librespot-org/librespot/commit/efec96b9cc2f8dab49b67aeae62c8dcd2a44331f) Put it all together ### 📊 Changes **38 files changed** (+3445 additions, -942 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `Cargo.toml` (+8 -2) 📝 `connect/Cargo.toml` (+1 -1) 📝 `connect/src/spirc.rs` (+1 -1) 📝 `core/Cargo.toml` (+4 -4) 📝 `core/src/session.rs` (+14 -2) 📝 `core/src/spclient.rs` (+14 -4) 📝 `discovery/Cargo.toml` (+1 -1) 📝 `examples/play.rs` (+2 -1) 📝 `examples/play_connect.rs` (+2 -1) 📝 `playback/Cargo.toml` (+1 -1) 📝 `playback/src/audio_backend/alsa.rs` (+328 -331) 📝 `playback/src/audio_backend/gstreamer.rs` (+10 -4) 📝 `playback/src/audio_backend/jackaudio.rs` (+14 -6) 📝 `playback/src/audio_backend/mod.rs` (+11 -4) 📝 `playback/src/audio_backend/pipe.rs` (+14 -8) 📝 `playback/src/audio_backend/portaudio.rs` (+46 -26) 📝 `playback/src/audio_backend/pulseaudio.rs` (+66 -43) 📝 `playback/src/audio_backend/rodio.rs` (+31 -18) 📝 `playback/src/audio_backend/sdl.rs` (+15 -9) _...and 18 more files_ </details> ### 📄 Description This PR adds resampling to 48kHz, 88.2kHz, and 96kHz with Windowed Sinc Interpolation. It also moves everything except decoding out of `player` and a few other misc improvements like improving thread creation in player, using `#[default]` in the player config enums where we can, and includes the sample pipeline latency in calculating an accurate position. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#1266
No description provided.