istft(input, n_fft, hop_length=None, win_length=None, window=None, center=True, normalized=False, onesided=None, length=None, return_complex=False)[source]¶
Inverse short time Fourier Transform. This is expected to be the inverse of
stft(). It has the same parameters (+ additional optional parameter of
length) and it should return the least squares estimation of the original signal. The algorithm will check using the NOLA condition ( nonzero overlap).
Important consideration in the parameters
centerso that the envelop created by the summation of all the windows is never zero at certain point in time. Specifically, .
stft()discards elements at the end of the signal if they do not fit in a frame,
istftmay return a shorter signal than the original signal (can occur if
centeris False since the signal isn’t padded). If length is given in the arguments and is longer than expected,
istftwill pad zeros to the end of the returned signal.
True, then there will be padding e.g.
'reflect', etc. Left padding can be trimmed off exactly because they can be calculated but right padding cannot be calculated without additional information.
Example: Suppose the last window is:
[17, 18, 0, 0, 0]vs
[18, 0, 0, 0, 0]
win_lengthare all the same which prevents the calculation of right padding. These additional values could be zeros or a reflection of the signal so providing
lengthcould be useful. If
Nonethen padding will be aggressively removed (some loss of signal).
 D. W. Griffin and J. S. Lim, “Signal estimation from modified short-time Fourier transform,” IEEE Trans. ASSP, vol.32, no.2, pp.236-243, Apr. 1984.
input (Tensor) –
The input tensor. Expected to be output of
stft(), can either be complex (
n_frame), or real (
n_frame, 2) where the
channeldimension is optional.
Deprecated since version 1.8.0: Real input is deprecated, use complex inputs as returned by
n_fft (int) – Size of Fourier transform
hop_length (Optional[int]) – The distance between neighboring sliding window frames. (Default:
n_fft // 4)
win_length (Optional[int]) – The size of window frame and STFT filter. (Default:
window (Optional[torch.Tensor]) – The optional window function. (Default:
center (bool) – Whether
inputwas padded on both sides so that the -th frame is centered at time . (Default:
normalized (bool) – Whether the STFT was normalized. (Default:
onesided (Optional[bool]) – Whether the STFT was onesided. (Default:
n_fft != fft_sizein the input size)
length (Optional[int]) – The amount to trim the signal by (i.e. the original signal length). (Default: whole signal)
return_complex (Optional[bool]) – Whether the output should be complex, or if the input should be assumed to derive from a real signal and window. Note that this is incompatible with
Least squares estimation of the original signal of size (…, signal_length)
- Return type