musicflower.loader.get_chroma

musicflower.loader.get_chroma(data, cqt=False, normal=False, harm=False, filter=False, smooth=True, asdict=False, loader=<function load>, **kwargs)[source]

Get chroma features from audio data.

Parameters:
  • data (Union[str, Tuple[ndarray, int]]) – a path to an audio file, which is loaded using librosa’s load function, or a tuple (y, sr) that is of the same type as returned by the load function, i.e. y: an audio time series as np.ndarray and sr the sampling rate

  • cqt (bool) – return constant-Q transform

  • normal (bool) – return “normal” chroma features

  • harm (bool) – filter harmonics before computing chroma features

  • filter (bool) – apply non-local filtering to chroma features

  • smooth (bool) – apply a horizontal median filter (after non-local filtering)

  • asdict (bool) – return results as a dict (keys are ‘cqt’, ‘normal’, ‘harm’, ‘filter’, ‘smooth’)

  • loader – the loader to use (defaults to librosa.load)

  • kwargs – kwargs passed to the cqt calls (librosa.cqt and/or librosa.feature.chroma_cqt)

Return type:

Union[Tuple[ndarray], Dict[str, ndarray], ndarray]

Returns:

tuple, dict, or Numpy array with results (cqt/normal/harm/filter/smooth as specified)