librosa.core.hz_to_octs

librosa.core.hz_to_octs(frequencies, A440=440.0)[source]

Convert frequencies (Hz) to (fractional) octave numbers.

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

scalar or vector of frequencies

A440 : float

frequency of A440 (in Hz)

Returns:
octaves : number or np.ndarray [shape=(n,)]

octave number for each frequency

See also

octs_to_hz

Examples

>>> librosa.hz_to_octs(440.0)
4.
>>> librosa.hz_to_octs([32, 64, 128, 256])
array([ 0.219,  1.219,  2.219,  3.219])