class audioflux.SimpleCQT(num=84, samplate=32000, low_fre=32.70319566257483)

Simple CQT spectrogram class.

It can create simple CQT spectrogram, and only set a few basic parameters. If you want more parameter settings, use CQT class to create.

SimpleCQT class fixed parameter:
  • bin_per_octave: 12

  • low_fre: 32.703(C1)

  • factor: 1

  • beta: 0

  • thresh: 0.01

  • window_type: HANN

  • slide_length: fft_length / 4

  • normal_type: AREA

  • is_scale: 1

num: int

Number of frequency bins to generate, starting at low_fre.

samplate: int

Sampling rate of the incoming audio.

low_fre: float

Lowest frequency. default: 32.703(C1)


Read 220Hz audio data

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

Create SimpleCQT object

>>> from audioflux.type import SpectralFilterBankNormalType
>>> from audioflux.utils import note_to_hz
>>> obj = af.SimpleCQT(num=84, samplate=sr, low_fre=note_to_hz('C1'))

Extract CQT spectrogram

>>> import numpy as np
>>> spec_arr = obj.cqt(audio_arr)
>>> spec_mag_arr = np.abs(spec_arr)

Show CQT spectrogram plot

>>> import matplotlib.pyplot as plt
>>> from audioflux.display import fill_spec
>>> audio_len = audio_arr.shape[-1]
>>> fig, ax = plt.subplots()
>>> img = fill_spec(spec_mag_arr, axes=ax,
>>>           x_coords=obj.x_coords(audio_len),
>>>           y_coords=obj.y_coords(),
>>>           x_axis='time', y_axis='log',
>>>           title='CQT Spectrogram')
>>> fig.colorbar(img, ax=ax)

Extract Chroma-cqt data

>>> chroma_arr = obj.chroma(spec_arr, chroma_num=12)

Show Chroma-CQT spectrogram plot

>>> fig, ax = plt.subplots()
>>> img = fill_spec(chroma_arr, axes=ax,
>>>           x_coords=obj.x_coords(audio_len),
>>>           x_axis='time', y_axis='chroma',
>>>           title='Chroma-CQT Spectrogram')
>>> fig.colorbar(img, ax=ax)



Calculate the length of a frame from audio data.

chroma(m_cqt_data[, chroma_num, data_type, ...])

Calculate the chroma matrix of CQT

cqcc(m_data_arr[, cc_num, rectify_type])

Compute the spectral cqcc feature.

cqhc(m_data_arr[, hc_num])

Compute the spectral cqhc feature.


Get spectrogram data


Compute the spectral deconv feature.


Get fft_length


Get an array of frequency bands of CQT scales.


Set scale


Get the X-axis coordinate


Get the Y-axis coordinate of CQT