Shortcuts

asteroid.dsp.overlap_add module

class asteroid.dsp.overlap_add.DualPathProcessing(chunk_size, hop_size)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Perform Dual-Path processing via overlap-add as in DPRNN [1].

Args:
chunk_size (int): Size of segmenting window. hop_size (int): segmentation hop size.

References

[1] “Dual-path RNN: efficient long sequence modeling for
time-domain single-channel speech separation”, Yi Luo, Zhuo Chen and Takuya Yoshioka. https://arxiv.org/abs/1910.06379
fold(x, output_size=None)[source]

Folds back the spliced feature tensor.

Input shape (batch, channels, chunk_size, n_chunks) to original shape (batch, channels, time) using overlap-add.

Parameters:
  • x – (torch.Tensor): spliced feature tensor of shape (batch, channels, chunk_size, n_chunks).
  • output_size – (int, optional): sequence length of original feature tensor. If None, the original length cached by the previous call of unfold will be used.
Returns:

x – (torch.Tensor): feature tensor of shape (batch, channels, time).

Note

fold caches the original length of the pr

static inter_process(x, module)[source]

Performs inter-chunk processing.

Parameters:
  • x (torch.Tensor) – spliced feature tensor of shape (batch, channels, chunk_size, n_chunks).
  • module (torch.nn.Module) – module one wish to apply between each chunk of the spliced feature tensor.
Returns:

x (torch.Tensor) –

processed spliced feature tensor of shape

(batch, channels, chunk_size, n_chunks).

Note

the module should have the channel first convention and accept a 3D tensor of shape (batch, channels, time).

static intra_process(x, module)[source]

Performs intra-chunk processing.

Parameters:
  • x (torch.Tensor) – spliced feature tensor of shape (batch, channels, chunk_size, n_chunks).
  • module (torch.nn.Module) – module one wish to apply to each chunk of the spliced feature tensor.
Returns:

x (torch.Tensor) –

processed spliced feature tensor of shape

(batch, channels, chunk_size, n_chunks).

Note

the module should have the channel first convention and accept a 3D tensor of shape (batch, channels, time).

unfold(x)[source]

Unfold the feature tensor from

(batch, channels, time) to (batch, channels, chunk_size, n_chunks).

Parameters:x – (torch.Tensor): feature tensor of shape (batch, channels, time).
Returns:x
(torch.Tensor): spliced feature tensor of shape
(batch, channels, chunk_size, n_chunks).
class asteroid.dsp.overlap_add.LambdaOverlapAdd(nnet, n_src, window_size, hop_size=None, window='hanning', reorder_chunks=True, enable_grad=False)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Segment signal, apply func, combine with OLA.

Parameters:
  • nnet (callable) – function to apply to each segment.
  • n_src (int) – Number of sources in the output of nnet.
  • window_size (int) – Size of segmenting window.
  • hop_size (int) – segmentation hop size.
  • window (str) – Name of the window (see scipy.signal.get_window)
  • reorder_chunks – whether to reorder each consecutive segment.
forward(x)[source]

Forward module: segment signal, apply func, combine with OLA.

Parameters:x (torch.Tensor) – waveform signal of shape (batch, 1, time).
Returns:torch.Tensor – The output of the lambda OLA.
ola_forward(x)[source]

Heart of the class: segment signal, apply func, combine with OLA.

Read the Docs v: v0.3.3
Versions
latest
stable
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.