Duration

Duration()

Any class that represents a basic unit of time and is notated as a single symbol.

Subclass Duration to create the specific duration unit(s) of a particular system. For example, WSMN’s note durations (quarter, half note, tuplets, etc), are managed by MetricalDuration.

WSMN only requires a single note duration type to cover standard note durations. Some temporal systems may need many different Duration types.

A Duration is a signed quantity: it can be negated and subtracted, so that a displacement between two events is a plain Duration.

>>> from openmusickit.systems.wsmn.temporal.symbols import quarter, eighth
>>> -quarter
MetricalDuration(-1, 4)
>>> quarter - eighth, eighth - quarter
(MetricalDuration(1, 8), MetricalDuration(-1, 8))

Attributes

Name Description
temporal_system The TemporalSystem this element belongs to (for introspection and compatibility checks).
__slots__

Methods

Name Description
__neg__ The same length in the opposite direction.
__sub__ self + (-other): the difference of two durations, in whatever notation it takes.

__neg__

__neg__()

The same length in the opposite direction.

Durations are signed quantities so that displacements (see TimedEdge.nudge) can be computed with ordinary arithmetic. A negative duration is never the length of an event: SequentialEvent rejects one.

__sub__

__sub__(other)

self + (-other): the difference of two durations, in whatever notation it takes.

>>> from openmusickit.systems.wsmn.temporal.symbols import half, quarter
>>> half - quarter, quarter - half
(MetricalDuration(1, 4), MetricalDuration(-1, 4))