Conversion between pitch and frequency

The objects mtof and ftom provide easy conversion between MIDI pitch numbers and their equivalent equal-tempered frequency values. The purpose of this patch is just to show the conversion formulae that those objects use.

pitch-to-frequency conversion

The number of semitones of pitch difference from the base pitch of A above middle C is divided by 12 and used as a power of 2 by which to multiply the base frequency of 440 Hz. Thus, each semitone up from A is an additional twelfth root of two multiplication of the base frequency; each semitone downward is a negative twelfth root of two factor.

The expr object allows you to type in any mathematical expression, including some math functions not be found in other objects—e.g., log(), atan(), etc.—using a syntax that’s very similar to C programming language.