quasimoto.riff package#

Submodules#

quasimoto.riff.chunk module#

A module implementing a RIFF-chunk interface.

class quasimoto.riff.chunk.Chunk(kind: ChunkType, size: int, data: bytes | None = None, form: ChunkType | None = None)[source]#

Bases: NamedTuple

A container for chunk data.

data: bytes | None#

Alias for field number 2

form: ChunkType | None#

Alias for field number 3

kind: ChunkType#

Alias for field number 0

size: int#

Alias for field number 1

Module contents#

A module implementing interfaces for RIFF files.

class quasimoto.riff.RiffInterface(stream: BinaryIO, is_writer: bool = True)[source]#

Bases: LoggerMixin

A class for reading and writing RIFF files.

chunks() Iterator[Chunk][source]#

Read file chunks.

finalize() None[source]#

Finalize the header size.

classmethod from_path(path: Path, is_writer: bool = True) Iterator[T][source]#

Create a RIFF interface from a path.

read() Chunk | None[source]#

Read the next chunk.

read_size() int[source]#

Read a size from the stream.

write(chunk: Chunk) None[source]#

Write a chunk to the file.

write_size(size: int, seek: int = None) None[source]#

An interface for writing a size field.