Created
March 31, 2022 14:05
-
-
Save HuangJiaLian/7dce30b3d48e0117839b404783517c68 to your computer and use it in GitHub Desktop.
Show labels of tempo and tempo marking
This file contains hidden or 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
# Function to determine the tempo markings | |
def tempo_marking_of(tempo): | |
for key in markings.keys(): | |
if tempo >= markings[key][0] and tempo <= markings[key][1]: | |
marking = key | |
break | |
else: | |
marking = '' | |
return marking | |
# When scale changes | |
def update(*args): | |
global scale_var, time_signature, interval_ms, tempo, tempo_label, marking_label | |
tempo = scale_var.get() | |
interval_ms = int((60/tempo) * (4/time_signature[-1]) * 1000) | |
tempo_label['text'] = '{}'.format(tempo) | |
marking = tempo_marking_of(tempo) | |
marking_label['text'] = '{}'.format(marking) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment