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 tofrequency[i]
(orfrequency
if the input is scalar)
See also
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']