torchaudio.functional.inverse_spectrogram¶
- torchaudio.functional.inverse_spectrogram(spectrogram: Tensor, length: Optional[int], pad: int, window: Tensor, n_fft: int, hop_length: int, win_length: int, normalized: Union[bool, str], center: bool = True, pad_mode: str = 'reflect', onesided: bool = True) Tensor [source]¶
Create an inverse spectrogram or a batch of inverse spectrograms from the provided complex-valued spectrogram.
- Parameters:
spectrogram (Tensor) – Complex tensor of audio of dimension (…, freq, time).
length (int or None) – The output length of the waveform.
pad (int) – Two sided padding of signal. It is only effective when
length
is provided.window (Tensor) – Window tensor that is applied/multiplied to each frame/window
n_fft (int) – Size of FFT
hop_length (int) – Length of hop between STFT windows
win_length (int) – Window size
normalized (bool or str) – Whether the stft output was normalized by magnitude. If input is str, choices are
"window"
and"frame_length"
, dependent on normalization mode.True
maps to"window"
.center (bool, optional) – whether the waveform was padded on both sides so that the \(t\)-th frame is centered at time \(t \times \text{hop\_length}\). Default:
True
pad_mode (string, optional) – controls the padding method used when
center
isTrue
. This parameter is provided for compatibility with the spectrogram function and is not used. Default:"reflect"
onesided (bool, optional) – controls whether spectrogram was done in onesided mode. Default:
True
- Returns:
Dimension (…, time). Least squares estimation of the original signal.
- Return type:
Tensor