Skip to content

Instantly share code, notes, and snippets.

@spacekitcat
Last active March 3, 2023 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spacekitcat/101fe3a275dbf68192b54edd2cb5b41e to your computer and use it in GitHub Desktop.
Save spacekitcat/101fe3a275dbf68192b54edd2cb5b41e to your computer and use it in GitHub Desktop.
from collections import deque
CHROMATIC_SCALE = deque(['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'])
MAJOR=[0, 2, 4, 5, 7, 9, 11]
MINOR=[0, 2, 3, 5, 7, 8, 10]
def printScaleLine(scale):
scaleOutputString=''
for x in scale:
scaleOutputString = scaleOutputString + x.ljust(3)
print(scaleOutputString.rjust(26))
def computeScale(chromaticScale, hepatonicScaleIndices):
return [CHROMATIC_SCALE[i] for i in hepatonicScaleIndices]
print()
print('MAJOR SCALES'.rjust(20))
for i in range(0, 12):
printScaleLine(computeScale(CHROMATIC_SCALE, MAJOR))
CHROMATIC_SCALE.rotate(1)
print()
print('MINOR SCALES'.rjust(20))
for i in range(0, 12):
printScaleLine(computeScale(CHROMATIC_SCALE, MINOR))
CHROMATIC_SCALE.rotate(1)
print()
@spacekitcat
Copy link
Author

spacekitcat commented Mar 3, 2023

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment