adamstark/AudioFile

Is partial loading possible?

Athospd opened this issue · 2 comments

I would like to load just an interval of a given .wav file aiming to avoid bringing the full audio to memory. Is it possible?
When I call .load(filepath) it seems to bring everything at once. Am I right?

Thank you for this awesome lib!

I'm working on a feature that allows this. It still loads all raw data to RAM, but only decodes the part you need. Is that acceptable in your case? You would use it like myAudioFile.load ("path_to_file", numFrames);

I'm still looking into only loading the raw data that is needed, because this current approach doesn't give much benefit over loading a full audio file and resizing it. But that would need a bit more of restructuring.

If you are interested you can find it here:
https://github.com/dedobbin/AudioFile/tree/partial-load

It's still WIP but if there is interest i can make a PR

I took a look at this but eventually decided against it - I explain more in the response to pull request #45, so have a look there for a full explanation :)