|
How to play a streaming Midi audio |
|
|
This Java tip illustrates a method of playing a streaming Midi audio. The audio
fies that are supported under this format are mid, rmf.
try {
Sequencer sequencer = MidiSystem.getSequencer();
sequencer.open();
// From file
InputStream input = new BufferedInputStream(
new FileInputStream(new File("midiaudiofile")));
// From URL
input = new BufferedInputStream(
new URL("http://hostname/rmffile").openStream());
sequencer.setSequence(input);
// Start playing
sequencer.start();
} catch (MalformedURLException e) {
} catch (IOException e) {
} catch (MidiUnavailableException e) {
} catch (InvalidMidiDataException e) {
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.