//Loading and Playing Midi Audio
try {
// From file
Sequence sequence = MidiSystem.getSequence(new File("midifile"));
// From URL
sequence = MidiSystem.getSequence(new URL("http://hostname/midifile"));
// Create a sequencer for the sequence
Sequencer sequencer = MidiSystem.getSequencer();
sequencer.open();
sequencer.setSequence(sequence);
// Start playing
sequencer.start();
} catch (MalformedURLException e) {
} catch (IOException e) {
} catch (MidiUnavailableException e) {
} catch (InvalidMidiDataException e) {
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment