music.scale¶
- music.scale(name='major', tonic=0)[source]¶
The semitones of a named scale, counted from tonic.
- Parameters:
- name
str One of
SCALES: the seven modes, the three minor scales, or"major"and"minor"for the two the article names twice.- tonic
integer Semitones to shift the whole scale by. Zero leaves it on its own tonic, which is how the article writes it.
- name
- Returns:
tupleofintegersThe degrees, in ascending order for every scale but the melodic minor, which the article writes as a rise and a fall.
- Raises:
ValueErrorIf name is not a scale this module knows.
- Parameters:
- Return type:
See also
mode_by_rotationthe same seven modes, reached by rotating the steps.
pitch_to_freqturns these semitones into frequencies.
Examples
>>> scale('major') (0, 2, 4, 5, 7, 9, 11) >>> scale('minor') == scale('aeolian') True >>> scale('dorian', tonic=2) (2, 4, 5, 7, 9, 11, 12)