f = frequency m = midi note number
f = 27.5 * 2((m - 21)/12)
m = (12/ln(2)) * ln(f/27.5) + 21
Note: Fractional midi note number will give you 'cents' from standard pitch: e.g. 66.33 would be 33 cents above F#4