Gagravarr / VorbisJava

A library for working with Ogg Vorbis files
Apache License 2.0
126 stars 26 forks source link

How do I use this? Does it work for .flac files? #16

Open dessalines opened 9 years ago

dessalines commented 9 years ago

There aren't any unit tests so I can't really see how to use it.

Gagravarr commented 9 years ago

You can see some FLAC related tests in https://github.com/Gagravarr/VorbisJava/tree/master/core/src/test/java/org/gagravarr/flac and https://github.com/Gagravarr/VorbisJava/blob/master/tika/src/test/java/org/gagravarr/tika/TestFlacParser.java plus use of it in https://github.com/Gagravarr/VorbisJava/blob/master/tools/src/main/java/org/gagravarr/flac/tools/FlacCommentTool.java - do those not cover what you need to see the FLAC code in use?

dessalines commented 9 years ago

Thanks, that's pretty much what I needed. Is there anyway to get the duration of the audio? In milliseconds preferably?

Gagravarr commented 9 years ago

It's possible that some encoding tools might store that duration in the metadata, but it isn't standard. If not, you'll have to iterate over all the audio packets to calculate it. The Tika Parser should be doing that already for all the file formats, so look there for the handful of calls you need to make

dessalines commented 9 years ago

I didn't see anything in that has to do with duration: https://github.com/Gagravarr/VorbisJava/blob/master/tika/src/test/java/org/gagravarr/tika/TestFlacParser.java