MIDI sequences

MIDI sequences are the logical cassettes that are played by concrete classes derived from TMIDIPlayer. They contain MIDI events and timing information for playing back prearranged performances and recording new ones. There are three time formats used in MIDI sequences:

    Time measured in terms of rhythmic meter, determined by the tempo and the resolution. The resolution is expressed as the number of MIDI ticks per quarter note.
    The time code developed by the Society of Motion Picture and Television Engineers (SMPTE), expressed as Hours:Minutes:Seconds:Frames. The SMPTE resolution is expressed as the number of MIDI ticks per frame. The MIDI system supports four SMPTE frame rates: 24fps, 25fps, 30fpsDropFrame, and 30fps.
A MIDI sequence contains a tempo track and one or more music tracks. The tempo track can be empty; it is used only for the metrical format.


MIDI track

A MIDI track represents a collection of MIDI packets. Each MIDI track uses the channel information in its packets--the packets contain the actual MIDI messages. Within a track, packets are sorted in order of increasing time stamp. Only one track can be recorded at a time, but multiple tracks can be played back simultaneously.

MIDI packet

A MIDI packet contains a MIDI message, time stamp, and status byte. All MIDI message types and structures are encapsulated by TMIDIPacket. For convenience, classes are derived from TMIDIPacket for interpreting specific MIDI message types.


The status byte facilitates sequence editing by allowing each message to be read individually--every packet contains a status byte that identifies the purpose of the data bytes that follow. Running status mode is never used. The time stamp provides an absolute offset from the beginning of a sequence--it consists of a TTime instance that is assigned when the message is received. The time stamp allows you to synchronize a sequence of packets to any available TSyncableClock instance. Therefore, you can synchronize MIDI sequences with external devices and other time media.


MIDI files

You use classes derived from TMIDISequence to convert to and from particular file formats. For example, you use TStandardMIDIFile to access standard MIDI files (MIDI format 0 and MIDI format 1). To support new or nonstandard file formats, you derive new classes from TMIDISequence.

MIDI file formats
A MIDI file contains one header chunk that is followed by one or more track chunks. Each chunk has a four-character type and a 32-bit length that indicates how many bytes of data follow. A header chunk provides basic information about the data in the file. A track chunk contains a sequential stream of MIDI data that can contain information for up to 16 MIDI channels. Track chunks are where actual song data is stored--each track chunk is simply a stream of MIDI events, preceded by delta-time values. Format 0 has only one track chunk, which can contain messages for multiple MIDI channels as well as the tempo data. Format 1 allows multiple track chunks, which represent tracks that can be played simultaneously.

NOTE In the current release, you must call TStandardMIDIFile::SetModified(kTrue) for the data in memory to be written to the file when the destructor for the TStandardMIDIFile is called.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker