A simple way to determine file duration


#1

Apologies in advance, I’m a JUCE noob and have been creating some interesting apps. I am recording some audio as WAV. I would like to determine the duration in seconds (I can display time accordingly). I understand I could crack open the file and read the chunks and do some calculations. Is there a simple convenience method in the JUCE library to determine this? I was going through the WavAudioFormatReader but nothing ‘jumped out at me’

Of course, any pointers to sample code would be great!

Thanks in advance.


#2

Hints: length in samples / sample rate

and

http://www.rawmaterialsoftware.com/juce/api/classAudioFormatReader.html


#3

Thanks. Hints were perfect. I’m on my way! :smiley: