Play midi files

Sorry to ask, I read the documentation about the javax.sound.midi but I really don't understant how to use it... I don't understand what each method does... I don't understand a @#€$%&.

Can somebody point me in a good direction, to a sample code or something alike? Anyone know how to play a midi file or how to loop it?

Help really appreciated...

[373 byte] By [Metallana] at [2007-10-2 5:37:29]
# 1

Have to say, reading the API docs is the hardest way to learn how to use a particular package.

But didn't you find the demo? This page has a link to it plus links to numerous other examples. You can take an example and bend it to do what you want, right?

http://java.sun.com/products/java-media/sound/reference/codesamples/index.html

DrClapa at 2007-7-16 1:47:57 > top of Java-index,Java Essentials,Java Programming...
# 2

Thank you for your answer, but I already saw the Java Sound Demo, the problem is that it is so extensive that I can't figure out which part does what... I wish that someone had a simple example showing how make a midi file play... by presing a button or something alike...

Isn't any way to do it almost as simple as AudioClip.play or .loop() or at least in less than 10 or 15 lines?

Metallana at 2007-7-16 1:47:57 > top of Java-index,Java Essentials,Java Programming...
# 3

What's wrong with AudioClip, then?

import java.applet.*;

public class Clip extends Applet

{

public void init()

{

String loc = "trippygaia1.mid";

AudioClip ac = getAudioClip(getCodeBase(), loc);

ac.play();

}

public void stop() { }

public void loop() { }

}

ChuckBinga at 2007-7-16 1:47:57 > top of Java-index,Java Essentials,Java Programming...
# 4
Hold it right there!Is it possible to create an AudioClip using a midi file? :o
Metallana at 2007-7-16 1:47:57 > top of Java-index,Java Essentials,Java Programming...
# 5
Have you tried?
ChuckBinga at 2007-7-16 1:47:57 > top of Java-index,Java Essentials,Java Programming...
# 6
Actually I have!!! (like 30 secs ago) I can't believe it!!! I still think the quality is not the greatest, but they indeed can be played... oh well.... thank you so much... I'm never taking the documentation so seriously again... it didn't say you could play midi files...
Metallana at 2007-7-16 1:47:57 > top of Java-index,Java Essentials,Java Programming...
# 7
If it doesn't say you can't. . .
ChuckBinga at 2007-7-16 1:47:57 > top of Java-index,Java Essentials,Java Programming...
# 8
But if it says that you can play .au .wav and (i don't remember what the other is), but it doesn't say you can play .mis, so i just assumed you can't... ah... whatever...
Metallana at 2007-7-16 1:47:57 > top of Java-index,Java Essentials,Java Programming...
# 9
But if it says that you can play .au .wav and (i don't remember what the other is), but it doesn't say you can play .mid, so i just assumed you can't... ah... whatever...
Metallana at 2007-7-16 1:47:57 > top of Java-index,Java Essentials,Java Programming...