music.interval¶
- music.interval(name)[source]¶
The number of semitones in an interval, from its traditional name.
- Parameters:
- name
str "P5","m3","aug4","TT", or a compound such as"M9"or"m16". Quality isP,M,m,aug(orA) anddim(ord).
- name
- Returns:
integerSemitones above the lower note.
- Raises:
ValueErrorIf the name is not an interval, or asks for a quality the degree cannot take – there is no major fifth.
- Parameters:
name (str)
- Return type:
See also
interval_namesthe same, backwards.
consonancehow the article classifies it.
midi_to_hz_intervalturns these semitones into a frequency ratio.
Examples
>>> interval("M3"), interval("P5"), interval("m7") (4, 7, 10) >>> interval("M9"), interval("P11"), interval("m16") (14, 17, 25) >>> interval("aug4") == interval("dim5") == interval("TT") True >>> interval("aug3") # a major third raised by a semitone 5