libmidi.types.track

MIDI track.

Classes

Track([events])

Class representing a MIDI track.

class libmidi.types.track.Track(events: List[Event] = None)

Class representing a MIDI track.

A MIDI track is a sequence of MIDI events. It starts with a header chunk and ends with a end of track meta message.

HEADER = b'MTrk'
__init__(events: List[Event] = None)

Initialize a track.

classmethod from_stream(stream: BufferedReader) Track

Read a track from a stream.

to_bytes() bytes

Write a track to bytes.

to_stream(stream: BufferedReader) int

Write a track to a stream.

Returns the number of bytes written.