import java.io.File;
import java.net.URL;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;
public class Main {
public static void main(String[] argv) throws Exception {
Sequence sequence = MidiSystem.getSequence(new File("midiaudiofile"));
sequence = MidiSystem.getSequence(new URL("http://hostname/midiaudiofile"));
// Create a sequencer for the sequence
Sequencer sequencer = MidiSystem.getSequencer();
sequencer.open();
sequencer.setSequence(sequence);
double durationInSecs = sequencer.getMicrosecondLength() / 1000000.0;
}
}
|