hi all -

i need to convert a frequency (Hz) to a pitch number in equal temperament. if i were using 440Hz tuning, this would be easy - i'd just use [ftom].

but i need this patch to work with ANY reference pitch, not just A4=440Hz.

the formula to do this is (i think!):

p = 12.Log2(f/R)

where p = note pitch number (A4 = 0)

f = frequency (Hz)

R = reference pitch (eg, A4 = 442 Hz)

the problem here is that i have no idea how to do a binary logarithm (log2) calculation in pd.

anyone have any ideas how to do this??

cheers,

jon.