librosax.feature.chroma_stft

chroma_stft(*, y: Array | None = None, sr: float = 22050, S: Array | None = None, norm: str | float | None = inf, n_fft: int = 2048, hop_length: int = 512, win_length: int | None = None, window: str = 'hann', center: bool = True, pad_mode: str = 'constant', tuning: float | None = None, n_chroma: int = 12, **kwargs) Array[source]

Compute a chromagram from a power spectrogram or waveform.

Parameters:
  • y

    Audio time series. The last axis must be time.

    • (T,) - single waveform

    • (B, T) - batch of waveforms

  • sr – Sampling rate

  • S – Power spectrogram with shape (..., F, N) (optional if y is provided)

  • norm – Column-wise normalization. See normalize for details.

  • n_fft – FFT window size

  • hop_length – Hop length

  • win_length – Window length

  • window – Window specification

  • center – Center the frames

  • pad_mode – Padding mode

  • tuning – Tuning deviation from A440 in fractional bins. If None, tuning will be automatically estimated (not implemented yet).

  • n_chroma – Number of chroma bins to produce

  • **kwargs – Additional arguments to chroma_filter (ctroct, octwidth, norm, base_c)

Returns:

Chromagram with shape (..., n_chroma, N).

  • (T,)(n_chroma, N)

  • (B, T)(B, n_chroma, N)