audioflux.chroma_octave(X, chroma_num=12, radix2_exp=12, samplate=32000, low_fre=32.70319566257483, high_fre=16000.0, window_type=WindowType.HANN, slide_length=1024, data_type=SpectralDataType.POWER, style_type=SpectralFilterBankStyleType.SLANEY, normal_type=SpectralFilterBankNormalType.NONE)

Octave chromagram

X: np.ndarray [shape=(…, n)]

audio time series.

chroma_num: int

Number of chroma bins to generate.

radix2_exp: int


samplate: int:

Sampling rate of the incoming audio.

low_fre: float

Lowest frequency. default: 32.703(C1)

high_fre: float or None

Highest frequency. Default is 16000(samplate/2).

window_type: WindowType

Window type for each frame.

See: type.WindowType

slide_length: int

Window sliding length.

data_type: SpectralDataType

Spectrogram data type.

See: type.SpectralDataType

style_type: SpectralFilterBankStyleType

Spectral filter bank style type. It determines the bank type of window.

see: type.SpectralFilterBankStyleType

normal_type: SpectralFilterBankNormalType

Spectral filter normal type. It determines the type of normalization.

See: type.SpectralFilterBankNormalType

out: np.ndarray [shape=(…, chroma_num, time)]

The matrix of chroma_octave


Read 220Hz audio data

>>> import audioflux as af
>>> audio_path = af.utils.sample_path('220')
>>> audio_arr, sr =

Extract chroma_octave data

>>> chroma_arr = af.chroma_octave(audio_arr, samplate=sr)

Show spectrogram plot

>>> import matplotlib.pyplot as plt
>>> from audioflux.display import fill_spec
>>> import numpy as np
>>> # calculate x-coords
>>> audio_len = audio_arr.shape[-1]
>>> x_coords = np.linspace(0, audio_len/sr, chroma_arr.shape[-1] + 1)
>>> fig, ax = plt.subplots()
>>> img = fill_spec(chroma_arr, axes=ax,
>>>                 x_coords=x_coords,
>>>                 x_axis='time', y_axis='chroma',
>>>                 title='Chroma_octave')
>>> fig.colorbar(img, ax=ax)