Scales, Chords & Intervals
The names Scale(), Key(), chord(), interval() and chord literals accept. The functions and
the Scale and Key types are in the std/theory reference.
Scales
Section titled “Scales”Accepted by Scale(name), Key(root, name) and track.set_key(name, root). scale_names() returns
the names, without the aliases.
| Scale | Aliases | Notes | Intervals (semitones) | Character |
|---|---|---|---|---|
"major" | "ionian" | 7 | 0 2 4 5 7 9 11 | Bright, happy, resolved |
"minor" | "aeolian" | 7 | 0 2 3 5 7 8 10 | Dark, melancholic |
"dorian" | — | 7 | 0 2 3 5 7 9 10 | Minor with a bright 6th |
"phrygian" | — | 7 | 0 1 3 5 7 8 10 | Spanish, exotic |
"lydian" | — | 7 | 0 2 4 6 7 9 11 | Dreamy, floating |
"mixolydian" | — | 7 | 0 2 4 5 7 9 10 | Bluesy major, rock |
"locrian" | — | 7 | 0 1 3 5 6 8 10 | Unstable, diminished |
"harmonic_minor" | — | 7 | 0 2 3 5 7 8 11 | Classical tension |
"melodic_minor" | — | 7 | 0 2 3 5 7 9 11 | Jazz minor |
"pentatonic_major" | — | 5 | 0 2 4 7 9 | Open, folk |
"pentatonic_minor" | — | 5 | 0 3 5 7 10 | Blues, rock riffs |
"blues" | — | 6 | 0 3 5 6 7 10 | Gritty, soulful |
"whole_tone" | — | 6 | 0 2 4 6 8 10 | Dreamlike, ambiguous |
"chromatic" | — | 12 | 0 1 2 3 4 5 6 7 8 9 10 11 | All semitones |
assert scale_names().length() == 14;assert Scale("pentatonic_minor").length() == 5;print(Scale("ionian").intervals()); // [0, 2, 4, 5, 7, 9, 11] — the major scaleA custom scale is an interval array starting at 0 and strictly ascending; fractional values are
microtonal. Scale(intervals, period) sets a repeat period other than 12 semitones.
load_scala(name) reads a Scala .scl file.
Chord qualities
Section titled “Chord qualities”Accepted by chord(root, quality), key.chord(degree, quality), and chord literals
(C4:min7, ^2:min7). chord_names() returns the names.
A chord literal writes each quality by its short name (maj, min, 5 for major, minor,
power). Literals also accept five shorthands that chord() and key.chord() do not: m
(min), m7 (min7), m9 (min9), m6 (min6) and dom (dom7).
| Quality | Aliases | Notes | Intervals (semitones) | Character |
|---|---|---|---|---|
"major" | "maj" | 3 | 0 4 7 | Bright, stable |
"minor" | "min" | 3 | 0 3 7 | Dark, melancholic |
"dim" | — | 3 | 0 3 6 | Tense, unstable |
"aug" | — | 3 | 0 4 8 | Bright, unsettled |
"7" | "dom7" | 4 | 0 4 7 10 | Bluesy, wants to resolve |
"maj7" | — | 4 | 0 4 7 11 | Lush, jazzy |
"min7" | — | 4 | 0 3 7 10 | Smooth, mellow |
"dim7" | — | 4 | 0 3 6 9 | Dramatic, symmetrical |
"aug7" | — | 4 | 0 4 8 10 | Altered dominant |
"sus2" | — | 3 | 0 2 7 | Open, ambiguous |
"sus4" | — | 3 | 0 5 7 | Suspended, tense |
"6" | "maj6" | 4 | 0 4 7 9 | Warm, vintage |
"min6" | — | 4 | 0 3 7 9 | Bittersweet |
"9" | — | 5 | 0 4 7 10 14 | Rich dominant |
"maj9" | — | 5 | 0 4 7 11 14 | Lush, expansive |
"min9" | — | 5 | 0 3 7 10 14 | Smooth, complex |
"add9" | — | 4 | 0 4 7 14 | Bright, open |
"power" | "5" | 2 | 0 7 | Neutral, heavy |
assert chord_names().length() == 18;print(chord(C4, "min7")); // [C4, Eb4, G4, Bb4]print(chord(C4, "power")); // [C4, G4]An inversion (chord(root, quality, n), or ~n in a literal) moves the lowest n notes up an
octave; a negative n moves the highest notes down.
Intervals
Section titled “Intervals”Accepted by interval(note, name). Case matters: "M3" is a major third, "m3" a minor third.
| Name | Aliases | Interval | Semitones |
|---|---|---|---|
"m2" | — | Minor 2nd | 1 |
"M2" | — | Major 2nd | 2 |
"m3" | — | Minor 3rd | 3 |
"M3" | — | Major 3rd | 4 |
"P4" | — | Perfect 4th | 5 |
"tritone" | "TT" | Tritone | 6 |
"P5" | — | Perfect 5th | 7 |
"m6" | — | Minor 6th | 8 |
"M6" | — | Major 6th | 9 |
"m7" | — | Minor 7th | 10 |
"M7" | — | Major 7th | 11 |
"P8" | "oct" | Octave | 12 |
assert interval(C4, "P5") == G4;assert interval(C4, "TT") == interval(C4, "tritone");print(interval(C4, "m3")); // Eb4