I want to play an audioclip in a standalone java program. I have tried extending applet but ultimately ran into security problems. I can get sound using AudioClip by extending applet, but i have searched in vain to be able to do this as a stand-alone. I have tried many things with AudioClip and i'm giving up hope. Is there any way to do this? Any other classes so i don't have to worry about he nitty gritty details of reading a .wav file . . . Also, do you know of any mp3 processing classes around, so that i may use mp3's instead of wav's? Thank you so much for looking at this. *matt*
Well, first, you don't need to extend Applet, or even instantiate it to play a sound. Just use the static methods Applet.newAudioClip() to get an AudioClip, then the static AudioClip.play() to play it. A more robust way is to use a media package. I've use Quicktime for Java before for this - it runs on Windows machines as well as Apple's, and it's free from Apple Computer. It's a really good library, but you'll have to get into more detail to take advantage of it. Another library is the all-java Java Media Framework (JMF) which is supposed to provide these kinds of services, although I have not played with this yet. Good luck!
Joined: Feb 25, 2002
That worked perfectly, thank you so much!!!
subject: Playing a sound in a stand alone Java program