You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
514 B

  1. import convert
  2. from math import log
  3. def tune_harm(a_c,n):
  4. '''Function that gives the tuning of a harmonic in relation to it's
  5. nearest equal temperment note.'''
  6. log_harm = a_c+12*log(n,2)
  7. equal_temp = round(log_harm)
  8. return (equal_temp,round(100*(log_harm-equal_temp)))
  9. def fingers(n,ff):
  10. c = int(2**((n-ff)/12))
  11. if c <= 0:
  12. c = 1
  13. while True:
  14. current = tune_harm(ff,c)
  15. if current[0] >= n and abs(current[1]) <= 14:
  16. return current[0]-n
  17. c += 1