samples to milliseconds:

  • (samples*1000)/sampling_rate = milliseconds

frequency to MIDI note pitch:

  • (log2(F/440) * 12) + 69 = MIDI note pitch

MIDI note to frequency:

  • 440 * 2 log2((note - 69) / 12)

def m2f(num=None):
    f = float(440) * float(2) ** ((float(num) - float(69))/float(12))
    return f

   for n in range(1,127):
    print n, m2f(n)

Some frequent equations I run into (last edited 2008-04-23 00:34:24 by NathanRamella)