Scale

Scales in the music library are defined as pitch class sets (i.e., chromatic scale degrees within one octave). The first pitch class sets is often 0, denoting the starting (root) note.

Here are the music library scale definitions in alphabetical order:

You can define your own scales in a similar way.

This representation allows us to use any MIDI note (pitch) as the starting note offset. For example, the following program outputs the pitches for a major scale starting at C4:

Change the C4 to another pitch, or change MAJOR_SCALE to another scale, and you will get the actual pitches in that scale.