A newer version of Max is available. Click here to access the latest version of the documentation

ftom Reference

Convert frequency to a MIDI note number

ftom

Description

Converts frequency, given in Hertz, to a MIDI pitch or note number (0-127).

Examples

Find the MIDI key number to play the same pitch as an MSP oscillator

Arguments

format [float]

Optional

If a float value is present, the ftom object outputs floating-point values. By default, it outputs int values.

Attributes

base [float]

Sets the "base frequency" used when converting frequency values (e.g., A = 440.). The default is 440.

Common Box Attributes

Messages

int

Arguments

frequency [int]
A frequency value. The corresponding MIDI pitch value (from 0 to 127) is sent out the outlet.

float

Arguments

frequency [float]
A frequency value. The corresponding MIDI pitch value (from 0 to 127) is sent out the outlet.

list

Arguments

list of frequencies [list]
A list of frequency values. Corresponding MIDI pitch values (from 0 to 127) for each list item are sent out the outlet.

Output

float

The MIDI note value that corresponds to the input frequency. When an input frequency falls between two equal tempered pitches, the value is rounded to the nearest int when ftom is used in its default int mode. When ftom is used in the optional float mode, the fractional part of the float is included. The fractional part could be used to calculate an additional pitch offset for applying MIDI pitch bend.

int

The MIDI note value that corresponds to the input frequency. When an input frequency falls between two equal tempered pitches, the value is rounded to the nearest int when ftom is used in its default int mode. When ftom is used in the optional float mode, the fractional part of the float is included. The fractional part could be used to calculate an additional pitch offset for applying MIDI pitch bend.

See Also

Name Description
MIDI MIDI
expr
mtof