TemporalContextEvent

TemporalContextEvent(duration: Duration | None = None)

Sets how the time of the material that follows is read: the meter it is organized by (MeterEvent), or the rate at which its durations pass (TempoEvent).

A temporal context belongs to the line it is in, as a division does, and governs what follows it there until the next one of its kind. A meter and a tempo are independent (a tempo change is not a meter change, and neither implies the other), so each is its own event, and a passage that opens with both has two nodes in its NEXT chain. Like every ContextEvent it has zero duration, so timing along the line passes straight through it:

>>> from openmusickit.graph.graph import GraphMeta, OmkGraph
>>> from openmusickit.objects.note_event import NoteEvent
>>> from openmusickit.systems.wsmn.temporal.symbols import four_four, quarter
>>> from openmusickit.systems.wsmn.tonal.symbols import C, D
>>> from openmusickit.values.time.clock_time import Tempo
>>> meter, tempo = MeterEvent(meter=four_four), TempoEvent(tempo=Tempo(120, quarter))
>>> c, d = NoteEvent(tones={C}, duration=quarter), NoteEvent(tones={D}, duration=quarter)
>>> graph = OmkGraph(GraphMeta())
>>> graph.add_line([meter, tempo, c, d])
>>> graph.relative_onset(meter, d)
MetricalDuration(1, 4)

Whether a line with no context of its own is read by the context of a line it is pinned or grouped with, or by an app’s default, is not decided here: absence of a context is absence of information.

Attributes

Name Description
meta
id
duration

Methods

Name Description
__setattr__
alter_duration

__setattr__

__setattr__(name: str, value: Any)

alter_duration

alter_duration(operation: Callable[[Duration, Any], Duration], operand: Any)