HPSS

class nussl.separation.hpss.HPSS(input_audio_signal, kernel_size=31, do_mono=False, use_librosa_stft=False, mask_type='soft')

Bases: nussl.separation.mask_separation_base.MaskSeparationBase

Implements harmonic/percussive source separation based on:

1. Fitzgerald, Derry. “Harmonic/percussive separation using median filtering.” 13th International Conference on Digital Audio Effects (DAFX10), Graz, Austria, 2010.

2. Driedger, Müller, Disch. “Extending harmonic-percussive separation of audio.” 15th International Society for Music Information Retrieval Conference (ISMIR 2014), Taipei, Taiwan, 2014.

This is a wrapper around the librosa implementation.

Parameters:
  • input_audio_signal – (AudioSignal object) The AudioSignal object that has the audio data that REPET will be run on.
  • kernel_size – int or tuple (kernel_harmonic, kernel_percussive) kernel size(s) for the median filters.
  • do_mono – (Optional) (bool) Flattens AudioSignal to mono before running the algorithm (does not effect the input AudioSignal object)
  • use_librosa_stft – (Optional) (bool) Calls librosa’s stft function instead of nussl’s
run()

Returns:

Example

make_audio_signals()

Returns the background and foreground audio signals. You must have run run() prior to calling this function. This function will return None if run() has not been called.

Order of the list is [self.background, self.foreground]

Returns:(list) – List containing two audio_signal.AudioSignal objects, one for the calculated background and the next for the remaining foreground, in that order.

Example:

1
2
3
4
5
6
7
8
9
# set up AudioSignal object
signal = nussl.AudioSignal('path_to_file.wav')

# set up and run repet
hpss = nussl.HPSS(signal)
hpss.run()

# get audio signals (AudioSignal objects)
harmonic, percussive = ft2d.make_audio_signals()