Scales
Using scale degrees for easier transposition
Use scale degrees instead of absolute note names. This makes it easy to transpose melodies and work within a musical key.
Basic Usage
Instead of writing specific notes like C4 E4 G4, use numbers 1-7 representing scale degrees:
[1 3 5] |> scale(C, major) |> saw // Plays C4 E4 G4
[1 3 5] |> scale(C, minor) |> saw // Plays C4 Eb4 G4
[1 3 5] |> scale(G, major) |> saw // Plays G4 B4 D5The numbers represent:
| Degree | Name |
|---|---|
| 1 | Root (tonic) |
| 2 | Second |
| 3 | Third |
| 4 | Fourth |
| 5 | Fifth |
| 6 | Sixth |
| 7 | Seventh |
Available Scales
Common Scales
major— The major scale (W-W-H-W-W-W-H)minor— Natural minor (W-H-W-W-H-W-W)
Modes
dorian— Minor with raised 6thphrygian— Minor with lowered 2ndlydian— Major with raised 4thmixolydian— Major with lowered 7thaeolian— Same as natural minorlocrian— Diminished mode
Other Scales
pentatonic— 5-note scale (1 2 3 5 6)blues— Blues scalechromatic— All 12 semitones
Root Notes
Use any note as the root:
- Natural notes:
C,D,E,F,G,A,B - Sharps:
C#,D#,F#,G#,A# - Flats:
Db,Eb,Gb,Ab,Bb
Examples
// C major triad
[1 3 5] |> scale(C, major) |> saw
// A minor arpeggio
[1 3 5 3] |> scale(A, minor) |> sine
// Full C major scale
[1 2 3 4 5 6 7] |> scale(C, major) |> triangle
// Same melody in different keys
let melody = [1 3 5 3 1]
play melody |> scale(C, major) |> saw
play melody |> scale(G, major) |> saw
play melody |> scale(D, minor) |> sawTransposing Made Easy
The real power of scales is easy transposition:
let melody = [1 3 5 6 5 3 1]
// Play in C major
play melody |> scale(C, major) |> saw
// Same melody, now in F major - just change the root!
play melody |> scale(F, major) |> saw
// Now in D minor
play melody |> scale(D, minor) |> saw