Get length of audio/mp3 file?

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.

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.

1 Like

Ok thanks, that’s helpful to know.