Module java.desktop

Class Sequence

java.lang.Object
javax.sound.midi.Sequence

public class Sequence
extends Object
A Sequence is a data structure containing musical information (often an entire song or composition) that can be played back by a Sequencer object. Specifically, the Sequence contains timing information and one or more tracks. Each track consists of a series of MIDI events (such as note-ons, note-offs, program changes, and meta-events). The sequence's timing information specifies the type of unit that is used to time-stamp the events in the sequence.

A Sequence can be created from a MIDI file by reading the file into an input stream and invoking one of the getSequence methods of MidiSystem. A sequence can also be built from scratch by adding new Tracks to an empty Sequence, and adding MidiEvent objects to these Tracks.

See Also:
Sequencer.setSequence(java.io.InputStream stream), Sequencer.setSequence(Sequence sequence), Track.add(MidiEvent), MidiFileFormat
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected float divisionType
    The timing division type of the sequence.
    static float PPQ
    The tempo-based timing type, for which the resolution is expressed in pulses (ticks) per quarter note.
    protected int resolution
    The timing resolution of the sequence.
    static float SMPTE_24
    The SMPTE-based timing type with 24 frames per second (resolution is expressed in ticks per frame).
    static float SMPTE_25
    The SMPTE-based timing type with 25 frames per second (resolution is expressed in ticks per frame).
    static float SMPTE_30
    The SMPTE-based timing type with 30 frames per second (resolution is expressed in ticks per frame).
    static float SMPTE_30DROP
    The SMPTE-based timing type with 29.97 frames per second (resolution is expressed in ticks per frame).
    protected Vector<Track> tracks
    The MIDI tracks in this sequence.
  • Constructor Summary

    Constructors 
    Constructor Description
    Sequence​(float divisionType, int resolution)
    Constructs a new MIDI sequence with the specified timing division type and timing resolution.
    Sequence​(float divisionType, int resolution, int numTracks)
    Constructs a new MIDI sequence with the specified timing division type, timing resolution, and number of tracks.
  • Method Summary

    Modifier and Type Method Description
    Track createTrack()
    Creates a new, initially empty track as part of this sequence.
    boolean deleteTrack​(Track track)
    Removes the specified track from the sequence.
    float getDivisionType()
    Obtains the timing division type for this sequence.
    long getMicrosecondLength()
    Obtains the duration of this sequence, expressed in microseconds.
    Patch[] getPatchList()
    Obtains a list of patches referenced in this sequence.
    int getResolution()
    Obtains the timing resolution for this sequence.
    long getTickLength()
    Obtains the duration of this sequence, expressed in MIDI ticks.
    Track[] getTracks()
    Obtains an array containing all the tracks in this sequence.

    Methods declared in class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait