Interval

Interval()

An Interval is a relationship between two tones, as defined within a specific tonal or sonic system.

Subclasses of Interval define the relationships of a tonal system, in concert with a subclass of Tone. A single class may play both roles; for example, TonalVector subclasses both Tone and Interval, since in Western notation a pitch and an interval share one representation.

>>> from openmusickit.systems.wsmn.tonal.tonal_vector import TonalVector
>>> isinstance(TonalVector((0, 0)), Interval)
True
>>> TonalVector((2, 4)).tonal_system.name
'Western Standard Music Notation'

Attributes

Name Description
__slots__
tonal_system The TonalSystem this interval belongs to (for introspection and compatibility checks).

Methods

Name Description
from_string Parses a string and returns an Interval.

from_string

from_string(s: str)

Parses a string and returns an Interval.

An optional hook: systems with a string form override it; the base raises.

>>> from openmusickit.systems.wsmn.tonal.tonal_vector import TonalVector
>>> TonalVector.from_string("M3")
TonalVector((2, 4))
>>> Interval.from_string("M3")
Traceback (most recent call last):
...
NotImplementedError