List of usage examples for javax.sound.midi Sequencer getMicrosecondLength
long getMicrosecondLength();
From source file:Main.java
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();/*from w w w . j ava2 s . com*/ sequencer.setSequence(sequence); double durationInSecs = sequencer.getMicrosecondLength() / 1000000.0; }