Created
January 31, 2020 14:41
-
-
Save sergkondr/5063b35129b5b4ba4e3e6ad1a98345d4 to your computer and use it in GitHub Desktop.
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
frets = 24 | |
_notes = ["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"] * int(frets/12 + 1) | |
def get_chord(n): | |
current = _notes | |
if n.find("m") == -1: | |
key = "maj" | |
else: | |
key = "min" | |
n = n.replace("m", "") | |
p = _get_note_position(n) | |
if key == "maj": | |
notes = current[p], current[p + 4], current[p + 7] | |
elif key == "min": | |
notes = current[p], current[p + 3], current[p + 7] | |
return notes | |
def _get_note_position(n): | |
for i in range(12): | |
if _notes[i] == n: | |
return i | |
return -1 | |
def print_griff(notes="", tune="EBGDAE"): | |
print(" |", end = "") | |
for i in range(1, frets + 1): | |
print("___{}".format(i).ljust(5), end = "") | |
print() | |
for s in range(len(tune)): | |
if notes == "": | |
string = "{} | ".format(tune[s]) | |
for fret in range(frets): | |
string += _snote(_notes[_get_note_position(tune[s]) + 1 + fret]) | |
else: | |
if tune[s] in notes: | |
string = "{} | ".format(tune[s]) | |
else: | |
string = "{} | ".format(" ") | |
for fret in range(frets): | |
n = _notes[_get_note_position(tune[s]) + 1 + fret] | |
if n in notes: | |
string += _snote(n) | |
else: | |
string += _snote(" ") | |
print(string) | |
print() | |
def _snote(n): | |
return "- {}".format(n).ljust(5) | |
if __name__ == "__main__": | |
# chord = input("ger chord:") | |
# print_griff(get_chord(chord)) | |
print_griff(["C", "A", "G", "E", "D"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment