librosa.core.hz_to_midi

librosa.core.hz_to_midi(frequencies)[source]

Get MIDI note number(s) for given frequencies

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

frequencies to convert

Returns:
note_nums : number 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.])