Created
November 12, 2023 07:00
-
-
Save Fannon/8b44fa9ba91fdf461ae398fc2a9d2179 to your computer and use it in GitHub Desktop.
Create all modal scales from the same pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const halfStepPattern = [2, 2, 1, 2, 2, 2, 1] | |
const modes = ["Ionian", "Dorian", "Phrygian", "Lydian", "Mixolydian", "Aeolian", "Locrian"] | |
const notes = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"] | |
const notesDoubled = notes.concat(notes) // double the array to get a cheap "ring buffer" | |
const patternDoubled = halfStepPattern.concat(halfStepPattern) | |
notes.forEach((note, noteIndex) => { | |
modes.forEach((mode, modeIndex) => { | |
let currentStep = 0 | |
const scaleNotes = [] | |
for (let stepIndex = 0; stepIndex < halfStepPattern.length; stepIndex++) { | |
scaleNotes.push(notesDoubled[noteIndex + currentStep]) | |
currentStep += patternDoubled[modeIndex + stepIndex] | |
} | |
console.log(`${note} ${mode}: ${scaleNotes.join(', ')}`) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment