libmidi.types.chunk

MIDI chunk.

Classes

Chunk(name, data)

Class representing a MIDI chunk.

class libmidi.types.chunk.Chunk(name: bytes, data: bytes)

Class representing a MIDI chunk.

A MIDI chunk is a sequence of bytes that starts with a 4-byte string, followed by a 32-bit integer representing the size of the following data.

__init__(name: bytes, data: bytes)

Initialize a chunk.

__str__() str

Return a string representation of the chunk.

classmethod from_bytes(data: bytes) Tuple[Chunk, bytes]

Read a chunk from bytes.

classmethod from_stream(buffer: BufferedReader) Chunk

Read a chunk from a stream.

get_length() int

Return length of data.

to_bytes() bytes

Return chunk as bytes.