java.lang.Object | |
↳ | javax.sound.midi.Sequence |
A Sequence
is a data structure containing musical
information (often an entire song or composition) that can be played
back by a
object. Specifically, the
Sequencer
Sequence
contains timing
information and one or more tracks. Each
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.
track
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
objects to these MidiEvent
Tracks
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
float | PPQ | The tempo-based timing type, for which the resolution is expressed in pulses (ticks) per quarter note. | |||||||||
float | SMPTE_24 | The SMPTE-based timing type with 24 frames per second (resolution is expressed in ticks per frame). | |||||||||
float | SMPTE_25 | The SMPTE-based timing type with 25 frames per second (resolution is expressed in ticks per frame). | |||||||||
float | SMPTE_30 | The SMPTE-based timing type with 30 frames per second (resolution is expressed in ticks per frame). | |||||||||
float | SMPTE_30DROP | The SMPTE-based timing type with 29.97 frames per second (resolution is expressed in ticks per frame). |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
divisionType | The timing division type of the sequence. | ||||||||||
resolution | The timing resolution of the sequence. | ||||||||||
tracks | The MIDI tracks in this sequence. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new MIDI sequence with the specified timing division
type and timing resolution.
| |||||||||||
Constructs a new MIDI sequence with the specified timing division
type, timing resolution, and number of tracks.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new, initially empty track as part of this sequence.
| |||||||||||
Removes the specified track from the sequence.
| |||||||||||
Obtains the timing division type for this sequence.
| |||||||||||
Obtains the duration of this sequence, expressed in microseconds.
| |||||||||||
Obtains a list of patches referenced in this sequence.
| |||||||||||
Obtains the timing resolution for this sequence.
| |||||||||||
Obtains the duration of this sequence, expressed in MIDI ticks.
| |||||||||||
Obtains an array containing all the tracks in this sequence.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
The tempo-based timing type, for which the resolution is expressed in pulses (ticks) per quarter note.
The SMPTE-based timing type with 24 frames per second (resolution is expressed in ticks per frame).
The SMPTE-based timing type with 25 frames per second (resolution is expressed in ticks per frame).
The SMPTE-based timing type with 30 frames per second (resolution is expressed in ticks per frame).
The SMPTE-based timing type with 29.97 frames per second (resolution is expressed in ticks per frame).
The timing division type of the sequence.
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,
divisionType
is PPQ (pulses per quarter note) and
the resolution is specified in ticks per beat. For SMTPE timing,
divisionType
specifies the number of frames per
second and the resolution is specified in ticks per frame.
The sequence will contain no initial tracks. Tracks may be
added to or removed from the sequence using
and createTrack()
.deleteTrack(Track)
divisionType | the timing division type (PPQ or one of the SMPTE types) |
---|---|
resolution | the timing resolution |
InvalidMidiDataException | if divisionType is not valid |
---|
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,
divisionType
is PPQ (pulses per quarter note) and
the resolution is specified in ticks per beat. For SMTPE timing,
divisionType
specifies the number of frames per
second and the resolution is specified in ticks per frame.
The sequence will be initialized with the number of tracks specified by
numTracks
. These tracks are initially empty (i.e.
they contain only the meta-event End of Track).
The tracks may be retrieved for editing using the
method. Additional tracks may be added, or existing tracks removed,
using getTracks()
and createTrack()
.deleteTrack(Track)
divisionType | the timing division type (PPQ or one of the SMPTE types) |
---|---|
resolution | the timing resolution |
numTracks | the initial number of tracks in the sequence. |
InvalidMidiDataException | if divisionType is not valid |
---|
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
. Tracks may be
removed from the sequence using getTracks()
.deleteTrack(Track)
Removes the specified track from the sequence.
track | the track to remove |
---|
true
if the track existed in the track and was removed,
otherwise false
.Obtains the timing division type for this sequence.
Obtains the duration of this sequence, expressed in microseconds.
Obtains a list of patches referenced in this sequence.
This patch list may be used to load the required
objects
into a Instrument
.Synthesizer
Patch
objects used in this sequenceObtains the timing resolution for this sequence. If the sequence's division type is PPQ, the resolution is specified in ticks per beat. For SMTPE timing, the resolution is specified in ticks per frame.
Obtains the duration of this sequence, expressed in MIDI ticks.
Obtains an array containing all the tracks in this sequence. If the sequence contains no tracks, an array of length 0 is returned.