Caution

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

librosa.core.hz_to_octs

librosa.core.hz_to_octs(frequencies, tuning=0.0, bins_per_octave=12, A440=<DEPRECATED parameter>)[source]

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

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

scalar or vector of frequencies

tuningfloat

Tuning deviation from A440 in (fractional) bins per octave.

bins_per_octaveint > 0

Number of bins per octave.

A440float <DEPRECATED>

frequency of A440 (in Hz)

Note

This parameter is deprecated in 0.7.1 and will be removed in version 0.8.0. Use tuning= instead.

Returns
octavesnumber 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])