librosa.hz_to_midi

librosa.hz_to_midi(frequencies)[source]

Get MIDI note number(s) for given frequencies

Parameters:
frequenciesfloat or np.ndarray [shape=(n,), dtype=float]

frequencies to convert

Returns:
note_numsnumber or np.ndarray [shape=(n,), dtype=float]

MIDI notes to frequencies

Examples

>>> librosa.hz_to_midi(60)
34.506
>>> librosa.hz_to_midi([110, 220, 440])
array([ 45.,  57.,  69.])