Google Search
// A Simple Midi Player
import java.io.*;
import javax.sound.midi.*;
public class PlayMidi {
public static void main (String[] args) {
PlayMidi mini = new PlayMidi();
mini.play();
}
public void play() {
try
{
Sequencer player = MidiSystem.getSequencer(true);
// provide midi filename or path between double quotes
File midifile= new File("filename.mid");
Sequence seq=MidiSystem.getSequence( midifile));
player.setSequence(seq);
player.open();
player.start();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}
No comments:
Post a Comment