MCPcopy Create free account
hub / github.com/espnet/espnet / forward_streaming

Method forward_streaming

espnet2/enh/decoder/stft_decoder.py:138–158  ·  view source on GitHub ↗

Forward. Args: input (ComplexTensor): spectrum [Batch, 1, F] output: wavs [Batch, 1, self.win_length]

(self, input_frame: torch.Tensor)

Source from the content-addressed store, hash-verified

136 return spec
137
138 def forward_streaming(self, input_frame: torch.Tensor):
139 """Forward.
140
141 Args:
142 input (ComplexTensor): spectrum [Batch, 1, F]
143 output: wavs [Batch, 1, self.win_length]
144 """
145 input_frame = self.spec_back(input_frame)
146 input_frame = input_frame.real + 1j * input_frame.imag
147 output_wav = (
148 torch.fft.irfft(input_frame)
149 if self.stft.onesided
150 else torch.fft.ifft(input_frame).real
151 )
152
153 output_wav = output_wav.squeeze(1)
154
155 n_pad_left = (self.n_fft - self.win_length) // 2
156 output_wav = output_wav[..., n_pad_left : n_pad_left + self.win_length]
157
158 return output_wav * self._get_window_func()
159
160 def streaming_merge(self, chunks, ilens=None):
161 """streaming_merge. It merges the frame-level processed audio chunks

Callers 2

stft_decoder.pyFile · 0.45

Calls 2

spec_backMethod · 0.95
_get_window_funcMethod · 0.95

Tested by 1