Short audio file + looping + long buffer = garbage [Patch included]


#1

AudioFormatReaderSource has a bug where reading very short files with a buffer longer than the file doesn’t work properly. The getNextAudioBlock function will naively assume it can handle all cases with one or two reads, and fails to read the right data. Please consider the attached patch.AudioFormatReaderSource.txt (2.2 KB)


#2

Thanks for the patch. I’ll have a look tomorrow.


#3

this will loop the file in the buffer if you use % for clamping the read position. would be better to just fill the buffer with the sample then fill with zeros the remaining samples


#4

kraken: It’s within the if (looping) conditional, see the topic also :wink:


#5

doh sorry i missed that.


#6

Any news on this?