librosa.core.hz_to_note

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

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

Parameters:
frequencies : float or iterable of float

Input frequencies, specified in Hz

kwargs : additional keyword arguments

Arguments passed through to midi_to_note

Returns:
notes : list 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']