0.23.0 is missing three fixes that are on master (#872 queue channel shift, #886 Spatial L/R swap, ChannelVolume averaging)
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 46/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- rust
- Domaine
- audio-video-rtc
Piste de recherche
Read the listed fixes #872, #886, and commit 55c103fdf, then compare their changes with the v0.23.0 tag and the reproducer in the issue. Start by running the reproducer against v0.23.0 and master to confirm the three symptoms; done means a release or backport includes all three fixes and those comparisons pass. The issue describes the bugs clearly, but coordinating a release or backport spans several changes.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
rodio 0.23.0 (published 2026-10-11) was cut from a line that diverged from master (GitHub compare: the v0.23.0 tag is behind each fix below), so three fixes already merged on master are not in the release. One program reproduces all three on 0.23.0 and shows each one fixed on master at 685e057.
Fix on master |
In v0.23.0? |
Symptom in 0.23.0 |
|---|---|---|
| #872 (8ca8cd0f4), channel shift when appending to an empty keep-alive queue | no (diverged, 45 behind) | Player::connect_new followed by append plays the first 512 samples of a stereo source as mono: each L and R sample is written to both channels, at half speed (10.7 ms at 48 kHz) |
#886 (6d31466ca), Spatial diff modifier swaps left and right (#884) |
no (diverged, 70 behind) | a source on the right plays louder in the left ear once the inverse-square term stops dominating (16 units right of ears at x = ±2) |
55c103fdf, ChannelVolume averaging |
no (diverged, 82 behind) | ChannelVolume::next computes the channel mean but discards it (self.current_sample.map(...) without assignment), so stereo input to Spatial is summed: exactly 2× (+6 dB) the level of the same signal as mono |
Output
0.23.0 (crates.io):
connect_new then append: first 8 samples [1.0, 1.0, -1.0, -1.0, 1.0, 1.0, -1.0, -1.0]; frames with wrong channels in first 2000: 512
Player::new, append, then mixer.add: first 8 samples [1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0]; frames with wrong channels: 0
Spatial, source 16 m right: left 0.003086 right 0.002551 (right louder expected: false)
Spatial stereo-in (0.5,0.5): (0.742574,0.742574) vs mono-in 0.5: (0.371287,0.371287); ratio 2.000
master at 685e05765c2aff8fbb51e32cda5b18428d09ffbe:
connect_new then append: first 8 samples [1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0]; frames with wrong channels in first 2000: 0
Player::new, append, then mixer.add: first 8 samples [1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0]; frames with wrong channels: 0
Spatial, source 16 m right: left 0.001543 right 0.005102 (right louder expected: true)
Spatial stereo-in (0.5,0.5): (0.371287,0.371287) vs mono-in 0.5: (0.371287,0.371287); ratio 1.000
Reproduction
Cargo.toml: rodio = { version = "=0.23.0", default-features = false, features = ["playback"] } (or a git dependency on the master rev above).
src/main.rs
use rodio::{buffer::SamplesBuffer, mixer, source::Spatial, Player, Source};
use std::num::NonZero;
fn stereo(frames: usize) -> SamplesBuffer {
// left = +1.0, right = -1.0 on every frame
let samples: Vec<f32> = (0..frames * 2).map(|i| if i % 2 == 0 { 1.0 } else { -1.0 }).collect();
SamplesBuffer::new(NonZero::new(2).unwrap(), NonZero::new(48_000).unwrap(), samples)
}
fn bad_frames(out: &[f32]) -> usize {
out.chunks(2).filter(|f| !(f[0] == 1.0 && f[1] == -1.0)).count()
}
fn main() {
// 1. Player attached to the mixer before the first append.
let (mx, mut out) = mixer::mixer(NonZero::new(2).unwrap(), NonZero::new(48_000).unwrap());
let player = Player::connect_new(&mx);
player.append(stereo(4000));
let v: Vec<f32> = (&mut out).take(4000).collect();
println!("connect_new then append: first 8 samples {:?}; frames with wrong channels in first 2000: {}", &v[..8], bad_frames(&v));
// 2. Same, but append before attaching the queue.
let (mx, mut out) = mixer::mixer(NonZero::new(2).unwrap(), NonZero::new(48_000).unwrap());
let (player2, queue) = Player::new();
player2.append(stereo(4000));
mx.add(queue);
let v: Vec<f32> = (&mut out).take(4000).collect();
println!("Player::new, append, then mixer.add: first 8 samples {:?}; frames with wrong channels: {}", &v[..8], bad_frames(&v));
// 3. Spatial: source 16 m to the right of ears at x = -2 / +2.
let src = SamplesBuffer::new(NonZero::new(1).unwrap(), NonZero::new(48_000).unwrap(), vec![1.0; 4]);
let mut sp = Spatial::new(src, [16.0, 0.0, 0.0], [-2.0, 0.0, 0.0], [2.0, 0.0, 0.0]);
let (l, r) = (sp.next().unwrap(), sp.next().unwrap());
println!("Spatial, source 16 m right: left {l:.6} right {r:.6} (right louder expected: {})", r > l);
// 4. Spatial (ChannelVolume) with stereo input 0.5 in both channels vs mono 0.5, source centred.
let st = SamplesBuffer::new(NonZero::new(2).unwrap(), NonZero::new(48_000).unwrap(), vec![0.5, 0.5]);
let mut sp = Spatial::new(st, [0.0, 0.0, 1.0], [-0.1, 0.0, 0.0], [0.1, 0.0, 0.0]);
let (l, r) = (sp.next().unwrap(), sp.next().unwrap());
let mono = SamplesBuffer::new(NonZero::new(1).unwrap(), NonZero::new(48_000).unwrap(), vec![0.5]);
let mut spm = Spatial::new(mono, [0.0, 0.0, 1.0], [-0.1, 0.0, 0.0], [0.1, 0.0, 0.0]);
let (ml, mr) = (spm.next().unwrap(), spm.next().unwrap());
println!("Spatial stereo-in (0.5,0.5): ({l:.6},{r:.6}) vs mono-in 0.5: ({ml:.6},{mr:.6}); ratio {:.3}", l / ml);
drop((player, player2));
}
Suggestion
A 0.23.x release from master, or a backport of these three, would fix them for crates.io users. Until then, a workaround for the first one on 0.23.0 is to build the player with Player::new(), append the first source, and only then mixer.add(queue). Related: #898 (users asking for a release containing the cpal 0.18 line).
Found while integrating 0.23.0 into a game engine's ECS audio path (Windows Server 2025, rustc 1.101.0-nightly 2026-10-24; release profile).
- Langage dominant
- Rust
- Étoiles
- 2.5k
- Forks
- 338
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de RustAudio/rodio
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 73/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 67/100
Toutes les issues de RustAudio/rodio
Issues similaires
-
bug nvim
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
-
chip:esp32c6 peripheral:dma
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
esp-rs/esp-hal#7037 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
BrettMayson/HEMTT#1445 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
Choochmeque/tauri-plugin-webdriver#134 ·
Les mainteneurs répondent en général sous 17 jours
-
bug(c-sdk): boxlite_box_exec does not check runtime liveness before dispatching streaming execOuvertebug rust SDK & CLI & REST API
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
boxlite-ai/boxlite#3292 ·
Les mainteneurs répondent en général sous 1 jour