speechbrain.inference.separation module

Specifies the inference interfaces for speech separation modules.

Authors:
  • Aku Rouhe 2021

  • Peter Plantinga 2021

  • Loren Lugosch 2020

  • Mirco Ravanelli 2020

  • Titouan Parcollet 2021

  • Abdel Heba 2021

  • Andreas Nautsch 2022, 2023

  • Pooneh Mousavi 2023

  • Sylvain de Langen 2023

  • Adel Moumen 2023

  • Pradnya Kandarkar 2023

Summary

Classes:

SepformerSeparation

A "ready-to-use" speech separation model.

Reference

class speechbrain.inference.separation.SepformerSeparation(modules=None, hparams=None, run_opts=None, freeze_params=True)[source]

Bases: Pretrained

A “ready-to-use” speech separation model.

Uses Sepformer architecture.

Example

>>> tmpdir = getfixture("tmpdir")
>>> model = SepformerSeparation.from_hparams(
...     source="speechbrain/sepformer-wsj02mix",
...     savedir=tmpdir)
>>> mix = torch.randn(1, 400)
>>> est_sources = model.separate_batch(mix)
>>> print(est_sources.shape)
torch.Size([1, 400, 2])
MODULES_NEEDED = ['encoder', 'masknet', 'decoder']
separate_batch(mix)[source]

Run source separation on batch of audio.

Parameters:

mix (torch.Tensor) – The mixture of sources.

Returns:

Separated sources

Return type:

tensor

separate_file(path, savedir='audio_cache')[source]

Separate sources from file.

Parameters:
  • path (str) – Path to file which has a mixture of sources. It can be a local path, a web url, or a huggingface repo.

  • savedir (path) – Path where to store the wav signals (when downloaded from the web).

Returns:

Separated sources

Return type:

tensor

forward(mix)[source]

Runs separation on the input mix

training: bool