Caution

You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.10.2.

librosa.hz_to_note

librosa.hz_to_note(frequencies, **kwargs)[source]

Convert one or more frequencies (in Hz) to the nearest note names.

Parameters:
frequenciesfloat or iterable of float

Input frequencies, specified in Hz

kwargsadditional keyword arguments

Arguments passed through to midi_to_note

Returns:
noteslist of str

notes[i] is the closest note name to frequency[i] (or frequency if the input is scalar)

Examples

Get a single note name for a frequency

>>> librosa.hz_to_note(440.0)
['A5']

Get multiple notes with cent deviation

>>> librosa.hz_to_note([32, 64], cents=True)
['C1-38', 'C2-38']

Get multiple notes, but suppress octave labels

>>> librosa.hz_to_note(440.0 * (2.0 ** np.linspace(0, 1, 12)),
...                    octave=False)
['A', 'A#', 'B', 'C', 'C#', 'D', 'E', 'F', 'F#', 'G', 'G#', 'A']