music.consonance¶
- music.consonance(interval_or_semitones)[source]¶
How the article classifies an interval.
- Parameters:
- interval_or_semitones
strorinteger An interval name, or its semitone count.
- interval_or_semitones
- Returns:
strOne of
"perfect consonance","imperfect consonance","weak dissonance","strong dissonance", or"context dependent"for the two the article declines to settle: the perfect fourth, “a perfect consonance when considered as an inversion of the perfect fifth and a dissonance or an imperfect consonance otherwise”, and the tritone, “consonant in some cultures”.
- Raises:
ValueErrorIf the interval is negative, or its name is not one.
- Parameters:
- Return type:
See also
CONSONANCEthe classification, as a table.
Notes
A compound interval “is classified in terms of the simple interval between the same notes but in the same octave”, so a major ninth is classified as the major second it is an octave above.
Examples
>>> consonance("P5") 'perfect consonance' >>> consonance("m2") 'strong dissonance' >>> consonance("P4"), consonance("TT") ('context dependent', 'context dependent')