RustAudio / audrey

A crate to simplify reading, writing and converting between a variety of audio formats.
Other
132 stars 16 forks source link

Reading OGG is very slow? (>50 seconds for 3MB file) #14

Closed bonsairobo closed 7 years ago

bonsairobo commented 7 years ago

Here's the code I'm running:

let mut song_ogg = audrey::open("resources/audio/song.ogg").unwrap();
let frames: Vec<Stereo<i16>> = song_ogg.frames()
    .filter(|x| x.is_ok())
    .map(Result::unwrap)
    .map(|x: [i16; 2]| Stereo { left: x[0], right: x[1] })
    .collect();

For whatever reason, this takes more than 50 seconds to run, but song.ogg is only 3.2 MB. Am I doing something wrong?

est31 commented 7 years ago

@bonsairobo do you have a release build? The ogg/vorbis decoder is written in rust, therefore a debug build is slower.

bonsairobo commented 7 years ago

Good call. The release build only takes a second or so. Sorry about the non-issue.