Caution

You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.10.2.

librosa.effects.harmonic

librosa.effects.harmonic(y, **kwargs)[source]

Extract harmonic elements from an audio time-series.

Parameters:
ynp.ndarray [shape=(n,)]

audio time series

kwargsadditional keyword arguments.

See librosa.decompose.hpss for details.

Returns:
y_harmonicnp.ndarray [shape=(n,)]

audio time series of just the harmonic portion

See also

hpss

Separate harmonic and percussive components

percussive

Extract only the percussive component

librosa.decompose.hpss

HPSS for spectrograms

Examples

>>> # Extract harmonic component
>>> y, sr = librosa.load(librosa.ex('choice'))
>>> y_harmonic = librosa.effects.harmonic(y)
>>> # Use a margin > 1.0 for greater harmonic separation
>>> y_harmonic = librosa.effects.harmonic(y, margin=3.0)