symusic.factory.ScoreFactory

class ScoreFactory[source]

Bases: object

High-level wrapper around the templated symusic.core.Score* classes.

It accepts MIDI/ABC paths, byte payloads, or other score instances and forwards everything to the nanobind implementation while preserving the per time-unit specializations.

__init__() None

Methods

__init__()

from_abc(abc[, ttype])

from_file(path[, ttype, fmt, sanitize_data, ...])

from_midi(data[, ttype, sanitize_data])

Parse MIDI bytes into a score and optionally sanitize payload values.

from_other(other[, ttype, min_dur])

from_tpq([tpq, ttype])

from_abc(abc: str, ttype: TimeUnit | str = 'tick') Score[source]
from_file(path: str | Path, ttype: TimeUnit | str = 'tick', fmt: str | None = None, sanitize_data: bool = False, format: str | None = None) Score[source]
from_midi(data: bytes, ttype: TimeUnit | str = 'tick', sanitize_data: bool = False) Score[source]

Parse MIDI bytes into a score and optionally sanitize payload values.

Parameters:

sanitize_data – Clamp MIDI payload bytes to the 7-bit range before parsing.

from_other(other: Score, ttype: TimeUnit | str = 'tick', min_dur: int | None = None) Score[source]
from_tpq(tpq: int = 960, ttype: TimeUnit | str = 'tick') Score[source]