Multimedia Audio in Java Concept Simplified

MultiMedia in Java
MultiMedia in Java

Multimedia in Java:

Multimedia is the processing of audio,video,images(graphics,texts in such a way that one can create them,interact with them in the real time manner). Since java has portability one of the core features , it can work with multimedia very smoothly.


Java can play audio over wide range of platforms if passes from URL in .au format.To reuse .wav or .aiff files, we need to convert them in .au format.Without conversion,if try to play an audio file we will get InvalidAudioFormatException.The .au file is 8 bit,8KHZ encoded audio file.The format does not represent the state of art in audio fidelity but suffice for most sound clips. By the play() method we can play an audio file.

public void play(URL url);
public void play(URL url,String name);

public void play(URL url), This method plays an audio clip if the audio clip represented by URL is found.
public void play(URL url,String name) plays an audio clip referred by the URL has many clips and matches with the name specified in the argument.

Once the URL refers the clip and by name it is found,java then loads the file into the memory then play once.

Disadvantages of Audio: 

  1. The first ti,e we call it with a given audio file,it will have to be download the file. Now this is the happy path . For a case where the path is broken due to any factors(the link is not valid,the audio file is not present),User ends up waiting for loading the file and play.
  2. If it present in an applet package and if we need to use it from other component or form within a thread,we need to have a reference to Applet class.It is not very efficient.
  3. Play() method sounds only once and must be called again and again to play the same sound multiple times.
See also  Class StringCharacterIterator in Java

Share and Enjoy !

Leave a Reply

Your email address will not be published. Required fields are marked *