madmom.audio.chroma

This module contains chroma related functionality.

class madmom.audio.chroma.DeepChromaProcessor(fmin=65, fmax=2100, unique_filters=True, models=None, **kwargs)[source]

Compute chroma vectors from an audio file using a deep neural network that focuses on harmonically relevant spectral content.

Parameters:
fmin : int, optional

Minimum frequency of the filterbank [Hz].

fmax : float, optional

Maximum frequency of the filterbank [Hz].

unique_filters : bool, optional

Indicate if the filterbank should contain only unique filters, i.e. remove duplicate filters resulting from insufficient resolution at low frequencies.

models : list of filenames, optional

List of model filenames.

Notes

Provided model files must be compatible with the processing pipeline and the values of fmin, fmax, and unique_filters. The general use case for the models parameter is to use a specific model instead of an ensemble of all models.

The models shipped with madmom differ slightly from those presented in the paper (less hidden units, narrower frequency band for spectrogram), but achieve similar results.

References

[1]Filip Korzeniowski and Gerhard Widmer, “Feature Learning for Chord Recognition: The Deep Chroma Extractor”, Proceedings of the 17th International Society for Music Information Retrieval Conference (ISMIR), 2016.

Examples

Extract a chroma vector using the deep chroma extractor:

>>> dcp = DeepChromaProcessor()
>>> chroma = dcp('tests/data/audio/sample2.wav')
>>> chroma  
array([[0.01317, 0.00721, ..., 0.00546, 0.00943],
       [0.36809, 0.01314, ..., 0.02213, 0.01838],
       ...,
       [0.1534 , 0.06475, ..., 0.00896, 0.05789],
       [0.17513, 0.0729 , ..., 0.00945, 0.06913]], dtype=float32)
>>> chroma.shape
(41, 12)
class madmom.audio.chroma.CLPChroma(data, fps=50, fmin=27.5, fmax=4200.0, compression_factor=100, norm=True, threshold=0.001, **kwargs)[source]

Compressed Log Pitch (CLP) chroma as proposed in [1] and [2].

Parameters:
data : str, Signal, or SemitoneBandpassSpectrogram

Input data.

fps : int, optional

Desired frame rate of the signal [Hz].

fmin : float, optional

Lowest frequency of the spectrogram [Hz].

fmax : float, optional

Highest frequency of the spectrogram [Hz].

compression_factor : float, optional

Factor for compression of the energy.

norm : bool, optional

Normalize the energy of each frame to one (divide by the L2 norm).

threshold : float, optional

If the energy of a frame is below a threshold, the energy is equally distributed among all chroma bins.

Notes

The resulting chromagrams differ slightly from those obtained by the MATLAB chroma toolbox [2] because of different resampling and filter methods.

References

[1](1, 2) Meinard Müller, “Information retrieval for music and motion”, Springer, 2007.
[2](1, 2, 3) Meinard Müller and Sebastian Ewert, “Chroma Toolbox: MATLAB Implementations for Extracting Variants of Chroma-Based Audio Features”, Proceedings of the International Conference on Music Information Retrieval (ISMIR), 2011.
class madmom.audio.chroma.CLPChromaProcessor(fps=50, fmin=27.5, fmax=4200.0, compression_factor=100, norm=True, threshold=0.001, **kwargs)[source]

Compressed Log Pitch (CLP) Chroma Processor.

Parameters:
fps : int, optional

Desired frame rate of the signal [Hz].

fmin : float, optional

Lowest frequency of the spectrogram [Hz].

fmax : float, optional

Highest frequency of the spectrogram [Hz].

compression_factor : float, optional

Factor for compression of the energy.

norm : bool, optional

Normalize the energy of each frame to one (divide by the L2 norm).

threshold : float, optional

If the energy of a frame is below a threshold, the energy is equally distributed among all chroma bins.

process(data, **kwargs)[source]

Create a CLPChroma from the given data.

Parameters:
data : Signal instance or filename

Data to be processed.

Returns:
clp : CLPChroma instance

CLPChroma.