OverlapAdd

class nussl.separation.overlap_add.OverlapAdd(input_audio_signal, separation_method, overlap_window_size=24, overlap_hop_size=12, overlap_window_type='triangular', do_mono=False, use_librosa_stft=False)

Bases: nussl.separation.separation_base.SeparationBase

Implements foreground/background separation using overlap/add with an arbitrary foreground/background
separation scheme in nussl.

Notes

Currently supports Repet, RepetSim, and FT2D.

Parameters:
  • input_audio_signal (audio_signal.AudioSignal) – The audio_signal.AudioSignal object that the
  • algorithm will be run on. This makes a copy of input_audio_signal (OverlapAdd) –
  • separation_method
  • overlap_window_size
  • overlap_hop_size
  • overlap_window_type
  • do_mono
  • use_librosa_stft

Example:

1
2
3
4
5
6
7
 import nussl

 signal = nussl.AudioSignal('path/to/audio.wav')

 ola = nussl.OverlapAdd(signal, nussl.Repet)  # initialize with class
 ola = nussl.OverlapAdd(signal, 'repet')  # initialize with string (case insensitive)
 ola.run()
repet

alias of nussl.separation.repet.Repet

repet_sim

alias of nussl.separation.repet_sim.RepetSim

ft2d

alias of nussl.separation.ft2d.FT2D

static valid_separation_methods()

Returns a list of class objects that OverlapAdd can use as its separation method Returns:

static valid_separation_method_names()

Returns a list of strings of class names that OverlapAdd can use as its separation method Returns:

separation_method_name

Returns the name of the current separation object Returns:

separation_method

Returns the current separation object Returns:

separation_instance

This the actual instance of the separation algorithm. If you need to make any modifications to the default behavior of the algorithm, this is where you would do it.

Returns:(SeparationBase) instance of the separation method.

Examples

run()
Returns:background (AudioSignal) – An AudioSignal object with background in background.audio_data (to get the corresponding non-repeating foreground run self.make_audio_signals())

Example

audio_signal

Copy of the audio_signal.AudioSignal object passed in upon initialization.

Type:(audio_signal.AudioSignal)
classmethod from_json(json_string)

Creates a new SeparationBase object from the parameters stored in this JSON string.

Parameters:json_string (str) – A JSON string containing all the data to create a new SeparationBase object.
Returns:(SeparationBase) A new SeparationBase object from the JSON string.

See also

to_json() to make a JSON string to freeze this object.

plot(output_name, **kwargs)

Plots relevant data for separation algorithm

Raises:NotImplementedError – Cannot call base class
sample_rate

Sample rate of audio_signal. Literally audio_signal.sample_rate.

Type:(int)
stft_params

spectral_utils.StftParams of audio_signal Literally audio_signal.stft_params.

Type:(spectral_utils.StftParams)
to_json()

Outputs JSON from the data stored in this object.

Returns:(str) a JSON string containing all of the information to restore this object exactly as it was when this was called.

See also

from_json() to restore a JSON frozen object.

make_audio_signals()

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

Returns:Audio Signals (List)

2 element list.

  • bkgd: Audio signal with the calculated background track
  • fkgd: Audio signal with the calculated foreground track

Example