Refactor hello.py to rename it to examples/chord_charts.py and improve chord chart display and playback

This commit is contained in:
2024-11-05 11:20:43 -05:00
parent 1e31196e19
commit 98ea64640d
2 changed files with 5 additions and 1 deletions
+5 -1
View File
@@ -25,6 +25,7 @@ all_chords = sorted(CHARTS["western"].keys())
print("Standard Guitar Chord Charts:")
print("-" * 30)
def fingering_to_tab(fingering):
if not fingering:
return ""
@@ -39,7 +40,9 @@ def fingering_to_tab(fingering):
if fret == 0:
strings[string_num] = "0" + strings[string_num][1:]
else:
strings[string_num] = "-" * (fret - 1) + str(fret) + strings[string_num][fret:]
strings[string_num] = (
"-" * (fret - 1) + str(fret) + strings[string_num][fret:]
)
# Combine strings with newlines, and add string names
tab = "e|" + strings[0] + "\n"
@@ -50,6 +53,7 @@ def fingering_to_tab(fingering):
tab += "E|" + strings[5] + "\n"
return tab
for chord_name in all_chords:
# Store original chord name for lookup
lookup_name = chord_name
View File