PlaythroughSection

timelines.PlaythroughSection(
    mc_start,
    mc_end,
    atomic_section_ids=(),
    typed_measures=None,
    groups=None,
)

A contiguous group of atomic sections in a specific traversal.

This is what gets written to .flow.csv and compared via is_equivalent(). Each PlaythroughSection represents a contiguous run of MCs in the unfolded sequence.

Note

MC ranges use the right-open interval convention [mc_start, mc_end), consistent with partitura and TimeToAlign’s TimeInterval model. For example, mc_start=1 and mc_end=9 means measures 1, 2, 3, 4, 5, 6, 7, 8 (eight measures total).

Attributes

Name Type Description
mc_start int First MC of this playthrough section (inclusive).
mc_end int First MC AFTER this playthrough section (exclusive, right-open).
atomic_section_ids tuple[str, …] Which atomic sections this covers.

Examples

>>> sec = PlaythroughSection(mc_start=1, mc_end=9, atomic_section_ids=("A", "B"))
>>> sec.mc_range
(1, 9)
>>> sec.mc_count
8

Methods

Name Description
to_dict Convert to dictionary for serialization.
to_mc_sequence Return list of all MCs in this section.

to_dict

timelines.PlaythroughSection.to_dict()

Convert to dictionary for serialization.

to_mc_sequence

timelines.PlaythroughSection.to_mc_sequence()

Return list of all MCs in this section.

Returns

Name Type Description
list[int] List of MC values from mc_start to mc_end (right-open, excludes mc_end).