librosa.effects.percussive

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

Extract percussive elements from an audio time-series.

Parameters:

y : np.ndarray [shape=(n,)]

audio time series

kwargs : additional keyword arguments.

See librosa.decompose.hpss for details.

Returns:

y_percussive : np.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.util.example_audio_file())
>>> y_percussive = librosa.effects.percussive(y)
>>> # Use a margin > 1.0 for greater percussive separation
>>> y_percussive = librosa.effects.percussive(y, margin=3.0)