Closed maxall41 closed 1 year ago
You will probably be better off using the next branch which has built in support for HTTP sources without using ffmpeg.
I am 99% sure that the issue is due to sample rate -- songbird current
requires a sample rate of 48 kHz as documented on all the relevant Input structs. Next
handles this for you, otherwise you will need to look into a crate like rubato
for correct audio resampling.
EDIT: The file you've linked has a sample rate of 22050 Hz, thus will sound sped up by ~2.18x. Other common sample rates include 44.1 kHz (~1.09x), 11025 Hz (~4.36x), 8 kHz (6x).
Oh. Yeah I looked into sample rate but couldn't find any thing in the docs. My bad. Thanks for your help!
Songbird version: Custom based off of 0.3.2
Rust version (
rustc -V
): 1.69.0Serenity/Twilight version: Serenity: 0.11.5 ...
Description: I'm trying to write a custom reader that streams files into a buffer as chunks so i don't have to frontload the entire file and then start playing it i created the following custom reader inside of the Songbird source code todo this:
And a custom source:
And it works pretty well except for an issue where for certain files it will play back at 5x speed or 2x speed or just slightly faster but it always seems to be faster and not slower. This does not happen if i load these files with ffmpeg but only when using my custom implementation. But as you can see in the above implemented reader i have also tested this with the default
Reader::Extension
type and I'm having the exact same issue. ...Steps to reproduce:
Reader::Extension