Example usage for javax.sound.midi Sequencer getMicrosecondLength

List of usage examples for javax.sound.midi Sequencer getMicrosecondLength

Introduction

In this page you can find the example usage for javax.sound.midi Sequencer getMicrosecondLength.

Prototype

long getMicrosecondLength();

Source Link

Document

Obtains the length of the current sequence, expressed in microseconds, or 0 if no sequence is set.

Usage

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;

}