rodio
rodio copied to clipboard
Some vorbis files distorted when sample rate is different from audio device
I have an Ogg Vorbis file that sounds distorted when played back with rodio over an USB audio device (have tried 2 different ones), but works over the headphone jack (macOS 11.3.1 on a Mac mini 2018; no problem on MacBook Pro 2015 with macOS 10.15.7).
I can reproduce on the current master, I just change the path to my file in examples/music_ogg.rs and run cargo run --example music_ogg
. If I oggdec
the file and use it with examples/music_ogg.wav, it works. Somehow, there must be a problem with decoding vorbis data under some circumstances (it works in VLC, ffplay, Audacity, so the Vorbis data itself should be no problem).
Here is the track in Vorbis and as WAV: https://easyupload.io/m/crad1n
It might be some sampling rate issue? No idea.
(Probably a wrong lead, but keep it here for documentation: I did a bisect. Before commit 3bc614fc12fae8afcb81f568efe215fe6a968993, it was crackling way more (and the .wav was also crackling), so the changes seem to have done something, but not resolved it completely. But could also be unrelated.)
It might be some sampling rate issue? No idea.
Seems so. The external USB interfaces were set to 48 kHz, whereas the internal one was set to 44.1 kHz. When using 44.1 kHz for the USB interface, the Vorbis file (which also is 44.1 kHz) works without crackling/distortion.
Will change the title accordingly.
Still wondering why the sample rate conversion works when playing the decoded .wav file, but not with the Vorbis file.