istft#
- diffsptk.ISTFT#
alias of
InverseShortTimeFourierTransform
- class diffsptk.InverseShortTimeFourierTransform(frame_length, frame_period, fft_length, *, center=True, window='blackman', norm='power')[source]#
This is the opposite module to
ShortTimeFourierTransform()
.- Parameters:
- frame_lengthint >= 1
The frame length in samples, \(L\).
- frame_periodint >= 1
The frame period in samples, \(P\).
- fft_lengthint >= L
The number of FFT bins, \(N\).
- centerbool
If True, pad the input on both sides so that the frame is centered.
- window[‘blackman’, ‘hamming’, ‘hanning’, ‘bartlett’, ‘trapezoidal’, ‘rectangular’, ‘nuttall’]
The window type.
- norm[‘none’, ‘power’, ‘magnitude’]
The normalization type of the window.
- forward(y, out_length=None)[source]#
Compute inverse short-time Fourier transform.
- Parameters:
- yTensor [shape=(…, T/P, N/2+1)]
The complex spectrogram.
- out_lengthint > 0 or None
The length of the output waveform.
- Returns:
- outTensor [shape=(…, T)]
The reconstructed waveform.
Examples
>>> x = diffsptk.ramp(1, 3) >>> x tensor([1., 2., 3.]) >>> stft_params = {"frame_length": 3, "frame_period": 1, "fft_length": 8} >>> stft = diffsptk.STFT(**stft_params, out_format="complex") >>> istft = diffsptk.ISTFT(**stft_params) >>> y = istft(stft(x), out_length=3) >>> y tensor([1., 2., 3.])
- diffsptk.functional.istft(y, *, out_length=None, frame_length=400, frame_period=80, fft_length=512, center=True, window='blackman', norm='power')[source]#
Compute inverse short-time Fourier transform.
- Parameters:
- yTensor [shape=(…, T/P, N/2+1)]
The complex spectrogram.
- out_lengthint >= 1 or None
The length of the output waveform.
- frame_lengthint >= 1
The frame length in samples, \(L\).
- frame_periodint >= 1
The frame period in samples, \(P\).
- fft_lengthint >= L
The number of FFT bins, \(N\).
- centerbool
If True, pad the input on both sides so that the frame is centered.
- window[‘blackman’, ‘hamming’, ‘hanning’, ‘bartlett’, ‘trapezoidal’, ‘rectangular’, ‘nuttall’]
The window type.
- norm[‘none’, ‘power’, ‘magnitude’]
The normalization type of the window.
- Returns:
- outTensor [shape=(…, T)]
The reconstructed waveform.