Get length of audio/mp3 file?


#1

Apologies if this has been answered elsewhere. I am wondering if there is a way to determine the length of an audio file with JUCE, without loading the file into memory. I guess that info is stored in the file header. I’d like to do this for a custom file browser to show the length of audio files in a folder.


#2

Well, it depends on the format. Certainly as soon as you create an AudioFormatReader it’ll contain the length. And for things like WAV it won’t need to read it, but other formats like MP3 may do a scan of the file when opening, as they need to do that to find the length.


#3

Ok thanks, that’s helpful to know.