librosa.effects.percussive

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

Extract percussive elements from an audio time-series.

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

audio time series. Multi-channel is supported.

**kwargsadditional keyword arguments.

See librosa.decompose.hpss for details.

Returns
y_percussivenp.ndarray [shape=(…, n)]

audio time series of just the percussive portion

See also

hpss

Separate harmonic and percussive components

harmonic

Extract only the harmonic component

librosa.decompose.hpss

HPSS for spectrograms

Examples

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