Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

java sound api

 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22568
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.".
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

https://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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic