Last active
February 5, 2021 19:45
-
-
Save eteich/092577ff66a4fc82db88d0fc2ad9f0a8 to your computer and use it in GitHub Desktop.
shimsham
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
import random | |
Sharps = ["C", "G", "D", "A", "E", "B", "F#", "Db", "Ab", "Eb", "Bb", "F"] | |
Ranges = [0.06, 0.18, 0.3, 0.42, 0.54, 0.66, 0.72, 0.76, 0.84, 0.90, 0.96] | |
Qualities = ["69", "mi13", "ma7#11", "7sus", 0, "7#11", "mi(ma7)", "mi7b5", "ma7#5", "mi6", "7b13"] | |
Modifiers = [0, 2, -1, 1, 0, 0, 1, 4, -2, 3, 2] | |
def chord(idx, Chord): | |
for i in range(len(Ranges)): | |
if Chord < Ranges[i]: | |
if isinstance(Qualities[i], str): | |
return (Sharps[(idx + Modifiers[i])%12] + " " + Qualities[i]) | |
else: | |
return (Sharps[idx%12] + " / " + Sharps[(idx + 4)%12]) | |
continue | |
return (Sharps[(idx+7)%12] + " 7") | |
for i in range(50 , 0, -1): | |
print(chord(i, random.random())) | |
print('tada.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment