Click to See Complete Forum and Search --> : Java MIDI support?????
Bootking
Apr 29th, 2003, 10:23 AM
Hey Everybody!
Anybody know how to play a MIDI file in Java or in Java applets?
I know it's possible but I just don't know how to do it.
CornedBee
Apr 29th, 2003, 10:49 AM
javax.sound.midi
Dillinger4
Apr 29th, 2003, 01:20 PM
Quite Easy. The java.applet.AppletStub and java.applet.AppletContext interfaces describe services that the web browser or applet viewer provides to applets. Note if your applet declares a main method these interfaces will have null AppletStub and AppletContext members. Therefore if you try to use these methods in such an applet a NullPointerException will be thrown.
The applet class has five methods that download sounds from the web. The two play() methods download a sound file and play it immediately. The two getAudioClip() methods and the static Applet.newAudioClip() method save a sound for later playing.
public void play(Url u)
public void play(Url u, String filename)
public AudioClip getAudioClip(Url u)
public AudioClip getAudioClip(Url u, String filename)
public static final AudioClip newAudioClip(Url u)
CornedBee
Apr 30th, 2003, 04:20 AM
But in non-Applets you still have to use the javax.sound.midi package...
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.