SilentTone
SilentTone()A musical silence, for example a rest.
Every SilentTone is equal to every other, so they can be used interchangeably as members of a set of Tones:
>>> SilentTone() == SilentTone()
True
>>> SilentTone() in {SilentTone()}
True
>>> isinstance(SilentTone(), Tone)
TrueA silence has no pitch, and belongs to no particular tonal system:
>>> SilentTone().pitch is None
True
>>> SilentTone().tonal_system.universal
TrueAttributes
| Name | Description |
|---|---|
__slots__ |
|
| pitch | The PitchRepresentation of this Tone, defined within a specific |
| tonal_system |
Methods
| Name | Description |
|---|---|
| from_string | Parses a string and returns a Tone. |
__format__ |
Display form of the Tone, used by str.format and f-strings. |
from_string
from_string(s: str)Parses a string and returns a Tone.
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("G#")
TonalVector((4, 8))
>>> Tone.from_string("G#")
Traceback (most recent call last):
...
NotImplementedError__format__
__format__(spec: str)Display form of the Tone, used by str.format and f-strings.
For pitched tones, the format spec names an attribute of the Tone’s PitchRepresentation, defaulting to unicode; unpitched tones fall back to str(). str() and repr() are unaffected, so they remain available as debug forms (use {tone!r} or {tone!s} in a template to get them).
>>> from openmusickit.systems.wsmn.tonal.tonal_vector import TonalVector
>>> from openmusickit.values.tone.silent_tone import SilentTone
>>> Eb = TonalVector((2, 3))
>>> f"{Eb} major"
'E♭ major'
>>> f"{Eb:ascii} major"
'Eb major'
>>> f"{Eb!r}"
'TonalVector((2, 3))'
>>> f"{SilentTone()}"
'SilentTone()'The spec must name a string attribute of the PitchRepresentation:
>>> f"{Eb:nonsense}"
Traceback (most recent call last):
...
ValueError: ...