tweak to tuner code
This commit is contained in:
parent
427610578e
commit
9ff4c4466d
@ -18,7 +18,7 @@ NOTES = "A B♭/A♯ B C D♭/C♯ D E♭/D♯ E F F♯/G♭ G A♭/G♯".split(
|
|||||||
# Get the note and octave using known note forumla
|
# Get the note and octave using known note forumla
|
||||||
def calculate_note(frequency):
|
def calculate_note(frequency):
|
||||||
if frequency > 0:
|
if frequency > 0:
|
||||||
note_num = round(math.log2(frequency / 440) * 12)
|
note_num = round(math.log2(frequency / A4) * 12)
|
||||||
octave = math.floor(4 + note_num / 12)
|
octave = math.floor(4 + note_num / 12)
|
||||||
rel_note = note_num % 12
|
rel_note = note_num % 12
|
||||||
note = NOTES[rel_note]
|
note = NOTES[rel_note]
|
||||||
|
Reference in New Issue
Block a user