Sequencer: setSequence(Sequence sequence) : Sequencer « javax.sound.midi « Java by API






Sequencer: setSequence(Sequence sequence)

  



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;

  }
}

   
    
  








Related examples in the same category

1.Sequencer: addMetaEventListener(MetaEventListener listener)
2.Sequencer.getMicrosecondPosition()
3.Sequencer: start()