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.
Sequencer#setSequence(java.io.InputStream stream) , Sequencer#setSequence(Sequence sequence), Track#add(MidiEvent), MidiFileFormat
| Modifier and Type | Field and Description |
|---|---|
| protected float | divisionType
The timing division type of the sequence. |
| public static final 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. |
| public static final float | SMPTE_24
The SMPTE-based timing type with 24 frames per second (resolution is expressed in ticks per frame). |
| public static final float | SMPTE_25
The SMPTE-based timing type with 25 frames per second (resolution is expressed in ticks per frame). |
| public static final float | SMPTE_30
The SMPTE-based timing type with 30 frames per second (resolution is expressed in ticks per frame). |
| public static final float | SMPTE_30DROP
The SMPTE-based timing type with 29.97 frames per second (resolution is expressed in ticks per frame). |
| protected Vector | tracks
The MIDI tracks in this sequence. |
| Access | Constructor and Description |
|---|---|
| public | Sequence(float
the timing division type (PPQ or one of the SMPTE
types) divisionType, int the timing resolution resolution)Constructs a new MIDI sequence with the specified timing division type and timing resolution. |
| public | Sequence(float
the timing division type (PPQ or one of the SMPTE
types) divisionType, int the timing resolution resolution, int the initial number of tracks in the sequence numTracks)Constructs a new MIDI sequence with the specified timing division type, timing resolution, and number of tracks. |
| Modifier and Type | Method and Description |
|---|---|
| public Track | Returns: the newly created trackCreates a new, initially empty track as part of this sequence. |
| public boolean | Returns: true if the track existed in the track and was removed,
otherwise falsethe track to remove track)Removes the specified track from the sequence. |
| public float | Returns: the division type (PPQ or one of the SMPTE types)Obtains the timing division type for this sequence. |
| public long | Returns: this sequence's duration in microsecondsObtains the duration of this sequence, expressed in microseconds. |
| public Patch[] | Returns: an array ofPatch objects used in this sequenceObtains a list of patches referenced in this sequence. |
| public int | Returns: the number of ticks per beat (PPQ) or per frame (SMPTE)Obtains the timing resolution for this sequence. |
| public long | Returns: this sequence's length in ticksObtains the duration of this sequence, expressed in MIDI ticks. |
| public Track[] |
| divisionType | back to summary |
|---|---|
| protected float divisionType The timing division type of the sequence.
| |
| PPQ | back to summary |
|---|---|
| public static final float PPQ The tempo-based timing type, for which the resolution is expressed in pulses (ticks) per quarter note.
| |
| resolution | back to summary |
|---|---|
| protected int resolution The timing resolution of the sequence.
| |
| SMPTE_24 | back to summary |
|---|---|
| public static final float SMPTE_24 The SMPTE-based timing type with 24 frames per second (resolution is expressed in ticks per frame).
| |
| SMPTE_25 | back to summary |
|---|---|
| public static final float SMPTE_25 The SMPTE-based timing type with 25 frames per second (resolution is expressed in ticks per frame).
| |
| SMPTE_30 | back to summary |
|---|---|
| public static final float SMPTE_30 The SMPTE-based timing type with 30 frames per second (resolution is expressed in ticks per frame).
| |
| SMPTE_30DROP | back to summary |
|---|---|
| public static final float SMPTE_30DROP The SMPTE-based timing type with 29.97 frames per second (resolution is expressed in ticks per frame).
| |
| tracks | back to summary |
|---|---|
| protected Vector<Track> tracks The MIDI tracks in this sequence.
| |
| Sequence | back to summary |
|---|---|
| public Sequence(float divisionType, int resolution) throws InvalidMidiDataException Constructs a new MIDI sequence with the specified timing division type
and timing resolution. The division type must be one of the recognized
MIDI timing types. For tempo-based timing,
| |
| Sequence | back to summary |
|---|---|
| public Sequence(float divisionType, int resolution, int numTracks) throws InvalidMidiDataException Constructs a new MIDI sequence with the specified timing division type,
timing resolution, and number of tracks. The division type must be one of
the recognized MIDI timing types. For tempo-based timing,
| |
| createTrack | back to summary |
|---|---|
| public Track createTrack() Creates a new, initially empty track as part of this sequence. The track
initially contains the meta-event End of Track. The newly created track
is returned. All tracks in the sequence may be retrieved using
| |
| deleteTrack | back to summary |
|---|---|
| public boolean deleteTrack(Track track) Removes the specified track from the sequence.
| |
| getDivisionType | back to summary |
|---|---|
| public float getDivisionType() Obtains the timing division type for this sequence.
| |
| getMicrosecondLength | back to summary |
|---|---|
| public long getMicrosecondLength() Obtains the duration of this sequence, expressed in microseconds.
| |
| getPatchList | back to summary |
|---|---|
| public Patch[] getPatchList() Obtains a list of patches referenced in this sequence. This patch list
may be used to load the required
| |
| getResolution | back to summary |
|---|---|
| public int getResolution() Obtains the timing resolution for this sequence. If the sequence's division type is PPQ, the resolution is specified in ticks per beat. For SMPTE timing, the resolution is specified in ticks per frame.
| |
| getTickLength | back to summary |
|---|---|
| public long getTickLength() Obtains the duration of this sequence, expressed in MIDI ticks.
| |
| getTracks | back to summary |
|---|---|
| public Track[] getTracks() Obtains an array containing all the tracks in this sequence. If the sequence contains no tracks, an array of length 0 is returned.
| |