Shortcuts

asteroid.separate module

class asteroid.separate.Protocol[source]

Bases: object

class asteroid.separate.Separatable[source]

Bases: asteroid.separate.Protocol

Things that are separatable.

forward_wav(wav: <sphinx.ext.autodoc.importer._MockObject object at 0x7f85c9b53690>, **kwargs) → <sphinx.ext.autodoc.importer._MockObject object at 0x7f85c9b536d0>[source]
Parameters:
  • wav (torch.Tensor) – waveform tensor. Shape: 1D, 2D or 3D tensor, time last.
  • **kwargs – Keyword arguments from separate.
Returns:

torch.Tensor

the estimated sources.

Shape: [batch, n_src, time] or [n_src, time] if the input wav did not have a batch dim.

sample_rate[source]

Operating sample rate of the model (float).

asteroid.separate.separate(model: asteroid.separate.Separatable, wav, output_dir=None, force_overwrite=False, resample=False, **kwargs)[source]

Infer separated sources from input waveforms. Also supports filenames.

Parameters:
  • model (Separatable, for example asteroid.models.BaseModel) – Model to use.
  • wav (Union[torch.Tensor, numpy.ndarray, str]) – waveform array/tensor. Shape: 1D, 2D or 3D tensor, time last.
  • output_dir (str) – path to save all the wav files. If None, estimated sources will be saved next to the original ones.
  • force_overwrite (bool) – whether to overwrite existing files (when separating from file).
  • resample (bool) – Whether to resample input files with wrong sample rate (when separating from file).
  • **kwargs – keyword arguments to be passed to forward_wav.
Returns:

Union[torch.Tensor, numpy.ndarray, None], the estimated sources.

(batch, n_src, time) or (n_src, time) w/o batch dim.

Note

separate calls model.forward_wav which calls forward by default. For models whose forward doesn’t have waveform tensors as input/ouput, overwrite their forward_wav method to separate from waveform to waveform.

asteroid.separate.torch_separate(model: asteroid.separate.Separatable, wav: <sphinx.ext.autodoc.importer._MockObject object at 0x7f85c9b53810>, **kwargs) → <sphinx.ext.autodoc.importer._MockObject object at 0x7f85c9b56590>[source]

Core logic of separate.

asteroid.separate.numpy_separate(model: asteroid.separate.Separatable, wav: numpy.ndarray, **kwargs) → numpy.ndarray[source]

Numpy interface to separate.

asteroid.separate.file_separate(model: asteroid.separate.Separatable, filename: str, output_dir=None, force_overwrite=False, resample=False, **kwargs) → None[source]

Filename interface to separate.

Read the Docs v: v0.4.4
Versions
latest
stable
v0.4.4
v0.4.3
v0.4.2
v0.4.1
v0.4.0
v0.3.5_b
v0.3.4
v0.3.3
v0.3.2
v0.3.1
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.