music.scale

music.scale(name='major', tonic=0)[source]

The semitones of a named scale, counted from tonic.

Parameters:
namestr

One of SCALES: the seven modes, the three minor scales, or "major" and "minor" for the two the article names twice.

tonicinteger

Semitones to shift the whole scale by. Zero leaves it on its own tonic, which is how the article writes it.

Returns:
tuple of integers

The degrees, in ascending order for every scale but the melodic minor, which the article writes as a rise and a fall.

Raises:
ValueError

If name is not a scale this module knows.

Parameters:
Return type:

tuple[int, …]

See also

mode_by_rotation

the same seven modes, reached by rotating the steps.

pitch_to_freq

turns 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)