Skip to content

Commit

Permalink
add frequency_to_note_cents function; update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
CedarGroveStudios committed Apr 26, 2023
1 parent 9682d76 commit bb54d45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cedargrove_midi_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def frequency_to_note_cents(frequency):
if (pow(2, (0 - 69) / 12) * 440) <= frequency <= (pow(2, (128 - 69) / 12) * 440):
note = int(69 + (12 * log(frequency / 440, 2)))
note_freq = pow(2, (note - 69) / 12) * 440
return note, int(1200 * log(frequency / note_freq))
return note, int(1200 * log(frequency / note_freq, 2))
return None, None # Frequency outside valid range


Expand Down

0 comments on commit bb54d45

Please sign in to comment.