Playing Sounds

Started by sukishan, Jul 15, 2009, 03:15 PM

Previous topic - Next topic

sukishan

Playing Sounds
The JApplet class in the Java Swing package (javax.swing), and the AudioClip interface in the Java Applet package (java.applet) provide basic support for playing sounds. Currently, the Java API supports only one sound format: 8 bit, ยต-law, 8000 Hz, one-channel, Sun ".au" files. You can create these on a Sun workstation using the audiotool application. You can convert files from other sound formats using an audio format conversion program.

Sound-Related Methods
Below are the sound-related Applet methods. The two-argument form of each method takes a base URL, which is usually returned by either getDocumentBase or getCodeBase, and the location of the sound file relative to the base URL.

getAudioClip(URL), getAudioClip(URL, String)
Return an object that implements the AudioClip interface.
play(URL), play(URL, String)
Play the AudioClip corresponding to the specified URL.
The AudioClip interface defines the following methods:

loop
Starts playing the clip repeatedly.
play
Plays the clip once.
stop
Stops the clip. Works with both looping and one-time sounds.
A good beginning makes a good ending

pradeep prem

from java clip we can easily play sound and audio clip

from java applet we can basic support for playing sound and loop has given

the website easy to recognize