Question

I am a bit confused about all of the various sound apis available in java. All I need is something to determine the length of a wma file. (Edit - I mean audio length in minutes, not bytes.) I don't need to play it or convert it or anything else. I understand that the native java api doesn't support wma. Can anyone recommend a good library/method that can easily get the length of a wma? (I found JAVE from searching here, but it seems like overkill in terms of setting up for just determining the length.) It will run on a Windows computer if that's relevant.

Was it helpful?

Solution

You can convert into byte array and you find size of wma file

OTHER TIPS

If you need just a length of a file in bytes use java.io.File.length() length method. It returns length of file in bytes independently what kind of file it is.

After I couldn't find anything else, I decided to use JAVE, and it wasn't hard at all. I hadn't realized that it already comes with the codecs precompiled, and it's just a matter of adding it to the classpath.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top