systems.wsmn.temporal.symbols
symbols
Ready-to-go note durations, tuplet ratios, and time signatures.
from openmusickit.systems.wsmn.temporal.symbols import *
Examples
>>> quarter
MetricalDuration(1, 4)>>> dotted_half
MetricalDuration(1, 2, dots=1)>>> breve
MetricalDuration(2, 1)>>> eighth_in_triplet.rational_length
Fraction(1, 12)>>> six_eight.rational_length
Fraction(3, 4)>>> six_eight == two_dotted_quarters
True>>> quarter + eighth == dotted_quarter
True>>> quarter + grace_eighth == quarter
TrueAttributes
Functions
| Name | Description |
|---|---|
| tuplet | nominal_count notes of base in the time of contextual_count notes of base. |
| triplet | 3 in the time of 2. |
| duplet | 2 in the time of 3 (for compound meters). |
| quintuplet | 5 in the time of 4. |
| sextuplet | 6 in the time of 4 (the same ratio as a triplet). |
| septuplet | 7 in the time of 4 (the common simple-meter septuplet; use tuplet(7, 6, …) for the other). |
| time_signature | A simple time signature n/d, presented as written. |
| additive_time_signature | An additive time signature such as 2+2+3/8. |
tuplet
tuplet(nominal_count: int, contextual_count: int, base: MetricalDuration)nominal_count notes of base in the time of contextual_count notes of base.
>>> tuplet(3, 2, quarter).multiplier
Fraction(2, 3)triplet
triplet(base: MetricalDuration)3 in the time of 2.
>>> triplet(quarter).multiplier
Fraction(2, 3)
>>> MetricalDuration(1, 8, ratio=triplet(eighth)).rational_length
Fraction(1, 12)duplet
duplet(base: MetricalDuration)2 in the time of 3 (for compound meters).
>>> duplet(eighth).multiplier
Fraction(3, 2)quintuplet
quintuplet(base: MetricalDuration)5 in the time of 4.
>>> quintuplet(sixteenth).multiplier
Fraction(4, 5)sextuplet
sextuplet(base: MetricalDuration)6 in the time of 4 (the same ratio as a triplet).
>>> sextuplet(sixteenth).multiplier
Fraction(2, 3)septuplet
septuplet(base: MetricalDuration)7 in the time of 4 (the common simple-meter septuplet; use tuplet(7, 6, …) for the other).
>>> septuplet(eighth).multiplier
Fraction(4, 7)time_signature
time_signature(n: int, d: int)A simple time signature n/d, presented as written.
>>> time_signature(3, 4)
TimeSignature([TemporalUnit(3, MetricalDuration(1, 4))], ('3', '4'))additive_time_signature
additive_time_signature(groups: list[int], d: int)An additive time signature such as 2+2+3/8.
>>> additive_time_signature([2, 2, 3], 8).presentation
('2+2+3', '8')