Read audio data from part of audio file

I know how load an entire file into an audioBuffer. But is there a way to get say 5-10 seconds worth from a given point.

I basically have an audio playback component which works great with upto 10 mins worth but I want to be effiecient with ram for larger files.

int lentoread = 44100;
int positiontostartreadingfrom = 100*44100;
reader->read(buffer, 0, lentoread, positiontostartreadingfrom , true, true);

“reader” is assumed to be an AudioFormatReader and “buffer” an AudioBuffer.

Maybe BufferingAudioReader or BufferingAudioSource is what you are looking for…

Yeah, if he wants to stream the audio from disk. But it wasn’t clear from the original post if he wants to do that or not.

Yes, was just meant as additional option… your solution is the least invasive!

Awesome. I thought there would be something like that.

Cheers for quick response.