librosax.feature.tonnetz¶
- tonnetz(*, y: Array | None = None, sr: float = 22050, chroma: Array | None = None, **kwargs) Array[source]¶
Compute the tonal centroid features (tonnetz).
This representation projects chroma features onto a 6-dimensional basis representing the perfect fifth, minor third, and major third each as two-dimensional coordinates.
- Parameters:
y –
Audio time series. The last axis must be time.
(T,)- single waveform(B, T)- batch of waveforms
sr – Sampling rate of y
chroma – Normalized energy for each chroma bin at each frame with shape
(..., n_chroma, N). If None, a chroma_stft is computed.**kwargs – Additional keyword arguments to chroma_stft, if chroma is not pre-computed.
- Returns:
Tonnetz features with shape
(..., 6, N).(T,)→(6, N)(B, T)→(B, 6, N)
Tonnetz dimensions:
0: Fifth x-axis
1: Fifth y-axis
2: Minor x-axis
3: Minor y-axis
4: Major x-axis
5: Major y-axis