Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java sound api  RSS feed

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use java sound api to get the metadata of sound files.

I do not need to play these sounds, I only want to get the metadata.

So the first question is:

Is there any other (better) API, to get Metadata of audio-files?

The second question:
I want to get the duration of a sound-file. There exists different approaches:



So how can I get the duration of a audioFile? The simplest solution af.getProperty("duration") always returns null.
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nimo frey wrote:Is there any other (better) API, to get Metadata of audio-files?

you could try JMF. That's the only one I can think of.


So how can I get the duration of a audioFile? The simplest solution af.getProperty("duration") always returns null.

How about Clip's getMicrosecondLength() method? It returns "the media duration, expressed in microseconds, or AudioSystem.NOT_SPECIFIED if the line is not open.".
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In addition to JMF, QuickTime for Java, xiph.org and some other libraries linked in the http://faq.javaranch.com/java/OtherOpenSourceProjectsFaq may help.
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay thank you.

The Tritonous-Libs http://www.tritonus.org/ does satisfy my needs.

(With (TAudioFileFormat) aff).properties(), I get the metadatas.)

How about Clip's getMicrosecondLength() method


I use the SourceDataLine not to hold the whole file into memory.

However, using a Applet and transferring the audiodata to the client, is not trivial:

http://www.coderanch.com/t/461637/Streams/java/audio-stream-via-network

Maybe I should use the new Java Media Components (What does JMC-API uses for transporting large media datas through network? UDP? Looking at examples like this http://javafx.com/samples/MediaBox/index.html, there is not latency, no distortion when playing the media file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!