-
Notifications
You must be signed in to change notification settings - Fork 268
Open
Labels
Description
I have some music after which I have appended some silence. I noticed this now causes popping sounds. I'm running Linux I haven't tested other OSes also reproduced the same behaviour running on Windows.
Repro
// [dependencies]
// rodio = "0.19"
fn main() {
const MUSIC: &[u8] = include_bytes!("../../rodio/assets/music.ogg");
let (_stream, handle) = rodio::OutputStream::try_default().unwrap();
let sink = rodio::Sink::try_new(&handle).unwrap();
sink.set_volume(0.8);
sink.append(
rodio::Decoder::new(Cursor::new(MUSIC))
.unwrap()
.skip_duration(Duration::from_secs(60)),
);
let silence = rodio::source::Empty::<u16>::new().delay(Duration::from_secs(5));
sink.append(silence);
while !sink.empty() {
println!("pos = {:.1?}", sink.get_pos());
std::thread::sleep(Duration::from_millis(100));
}
println!("done");
}
- When the music finishes ~9.4 I hear a pop
- When the "silence" finishes after additional 5s I hear another pop
Expected behaviour
No pops.
Let me know also if there is a better way to do this.