Caution

You're reading the documentation for a development version. For the latest released version, please have a look at 0.10.1.

librosa.effects.percussive

librosa.effects.percussive(y, *, kernel_size=31, power=2.0, mask=False, margin=1.0, n_fft=2048, hop_length=None, win_length=None, window='hann', center=True, pad_mode='constant')[source]

Extract percussive elements from an audio time-series.

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

audio time series. Multi-channel is supported.

kernel_size
power
mask
margin

See librosa.deocmpose.hpss

n_fft
hop_length
win_length
window
center
pad_mode

See librosa.stft

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)