ModalContext
ModalContext()A tonal centre and the tones heard in relation to it.
This is the general idea behind what different systems call a key, a mode, a maqam, a raga, or a pathet: WSMN’s Key (tonic, mode pattern and key signature) is one implementation. A ModalContextEvent places one in a score to govern the material that follows.
Anything that is notation rather than musical content (WSMN’s printed key signature, for instance) belongs to the implementing system, not here.
>>> from openmusickit.systems.wsmn.tonal.symbols import C, M2, Major
>>> from openmusickit.systems.wsmn.tonal.key import Key
>>> from openmusickit.systems.wsmn.tonal.tonal_vector import TonalVector
>>> key = Key.of(C, Major)
>>> isinstance(key, ModalContext)
True
>>> key.tonic, key.name, len(key.tones)
(TonalVector((0, 0)), 'C Major', 7)
>>> key.transform(TonalVector.transpose, M2).name
'D Major'Attributes
| Name | Description |
|---|---|
__slots__ |
|
| tonic | The tonal centre; None for material with no modal context (atonal music, unpitched parts). |
| tones | The tones of the context, in relation to the tonic. |
| name | A human-readable name, such as ‘D Major’ or ‘No Key’. |
Methods
| Name | Description |
|---|---|
| transform | Returns a new ModalContext made by applying operation(tone, *args, **kwargs) |
transform
transform(operation: Callable[..., Tone], *args, **kwargs)Returns a new ModalContext made by applying operation(tone, *args, **kwargs) to the tonic and tones, in whatever way keeps the context coherent for its system.