java - Retrieving the title, artist/author and duration of a .wav file -


i trying properties of .wav file using in java project using following code. when run code methods format.getproperty("title"), format.getproperty("author"), , format.getproperty("duration") return null. should getting these details in different way?

audioinputstream audioinputstream = audiosystem.getaudioinputstream(wavfile); audioformat format = audioinputstream.getformat(); object[] temp = {false,         format.getproperty("title"),         format.getproperty("author"),         format.getproperty("duration")}; 

wav files hard work with, though they can hold several metadata types. depending upon software , encoder used (16/32-bit pcm) can have different configurations file , java sound api face problems read metadata.

i tried lot of tools , libs focused in audio metatagging (such apache tika, jd3lib, mp3agic, beaglebuddy, etc.) , of them work fine mp3 or other audio formats, not wav files.

apparently, better 1 handling jaudiotagger. it's simple, fast , can accomplish goal doing like:

audiofile f = audiofileio.read(wavfile); wavtag tag = (wavtag) f.gettag();  object[] temp = {false,         tag.getfirst(fieldkey.title),         tag.getfirst(fieldkey.artist),         f.getaudioheader().gettracklength() // in seconds }; 

also, refer following links:

note: support feature added version 2.2.4 above. so, prefer the latest version evict compatibility problems.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -