Closed chess92 closed 1 year ago
One alternative would be to use AudioDecoder
and then calculate the duration using frameLength
and sample rate.
However, it appears that Opus::Properties
has a method lengthInMilliseconds()
which is what you're after. I will update SFBOggOpusFile
to use this property instead of length()
which is just an alias for lengthInSeconds()
.
Please try the code in #249 and see if it is more accurate.
Just tested this and it works great! Thank you.
I am trying to get the duration of an OPUS file in milliseconds. This is what I have currently:
The result of
audioFile.properties.duration
is seconds. With other libraries, this is normally fine because it would be something like 546.342 which could be converted to milliseconds by multiplying by 1000.0. But the above code produces 546.0 which cannot be used to get milliseconds.Is there another way to get duration for OPUS files?