For a quick solution, try using java.applet.AudioClip class.
// there is a folder named waves in the same folder that has the html
String path= "waves/tone.wav" ;
// For an applet
clip= myapplet.getAudioClip(getDocumentBase(), path );
// For anything else - I think it even works with consol screen no gui
clip = Applet.newAudioClip(URL url) ;
the Applet.newAudioClip(URL url) is a static method in Applet. so you could use it without creating an applet instance.
The url might be
URL url =new File(path).toURL();
URL url= this.getClass().getResource (path);
where path is either the fully qualified pathname of the tone file(.wav .au and midi only) or relative to the classes classloader.
If you need more media types look at the JMF (Java Media Foundation) packages from sun (java.sun.com search JMF )
Look up Roedy Green's example of tone generation by byte manipulation.
very nice, but may not be portable as-is (as it uses com.sun classes -I think)
but is extensible to JMF Player with some work.
: thanks for the link Iceperson.
: I need a little more help I'm afraid.
: I've begun with the first programming example, and I'm trying to compile it from the command line as it says.:
: 1 error:
: C:\>javac -classpath c:\jfugue MyMusicApp.java
: MyMusicApp.java:9: cannot resolve symbol
: symbol : method play ()
: location: class org.jfugue.Pattern
: 1 error
: and then there's a circumflex-thingy pointing at the dot of .play (which I can't find on my keyb)
: I believe my java is uptodate- I got the latest one from Sun a month or so ago....
: And I'm assuming I've done the classpath thing right as I had even more errors before (eg if I tried to javac without the jfugue classpath)..
: thanks for your patience
: : is there a Java class for basic musical commands like qbasic has?
: : :
: : http://innix.com/jfugue/
: : Iceman
: : Unix is user friendly. It's just very particular about who its friends are.