Branch

Branch(
    type: EdgeType,
    origin: EdgeOrigin = EdgeOrigin.ASSERTED,
    anchor: TimingAnchor = TimingAnchor.ONSET,
    displacement: Duration | None = None,
)

From an event of a parent line to the head of a child line that the same performer does at the same time: a second voice, the other hand.

A branch asserts ownership: span walks over the parent include the child. A head has at most one incoming Branch and no incoming NEXT.

>>> from openmusickit.systems.wsmn.temporal.symbols import quarter
>>> late = Branch(anchor=TimingAnchor.OFFSET, displacement=quarter)
>>> late.type, late.anchor, late.displacement
(<EdgeType.BRANCHES: 'branches'>, <TimingAnchor.OFFSET: 'offset'>, MetricalDuration(1, 4))
>>> Branch().anchor, Branch().displacement is None
(<TimingAnchor.ONSET: 'onset'>, True)
>>> late
Branch(anchor=offset, displacement=MetricalDuration(1, 4))

Attributes

Name Description
origin
meta
id
anchor
displacement
type

Methods

Name Description
__repr__
nudge Nudges the displacement of this edge in the specified direction by the specified amount.

__repr__

__repr__()

nudge

nudge(direction: NudgeDirection, amount: Duration)

Nudges the displacement of this edge in the specified direction by the specified amount.

The displacement is a signed Duration: negative means the target starts before the anchor.

>>> from openmusickit.systems.wsmn.temporal.symbols import quarter, half
>>> edge = Branch()
>>> edge.nudge(NudgeDirection.FORWARD, quarter)
>>> edge.nudge(NudgeDirection.BACKWARD, half)
>>> edge.displacement
MetricalDuration(-1, 4)

Raises

Name Type Description
TemporalCompatibilityError if amount belongs to a different temporal system than the current displacement.