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
Frame length, \(L\).
- frame_periodint >= 1
Frame period, \(P\).
- fft_lengthint >= L
Number of FFT bins, \(N\).
- centerbool
If True, assume that the center of data is the center of frame, otherwise assume that the center of data is the left edge of frame.
- window[‘blackman’, ‘hamming’, ‘hanning’, ‘bartlett’, ‘trapezoidal’, ‘rectangular’]
Window type.
- norm[‘none’, ‘power’, ‘magnitude’]
Normalization type of window.
- forward(y, out_length=None)[source]#
Compute inverse short-time Fourier transform.
- Parameters:
- yTensor [shape=(…, T/P, N/2+1)]
Complex spectrum.
- out_lengthint or None
Length of output waveform.
- Returns:
- outTensor [shape=(…, T)]
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)]
Complex spectrum.
- out_lengthint >= 1 or None
Length of output signal.
- frame_lengthint >= 1
Frame length, \(L\).
- frame_peirodint >= 1
Frame period, \(P\).
- fft_lengthint >= L
Number of FFT bins, \(N\).
- centerbool
If True, assume that the center of data is the center of frame, otherwise assume that the center of data is the left edge of frame.
- window[‘blackman’, ‘hamming’, ‘hanning’, ‘bartlett’, ‘trapezoidal’, ‘rectangular’, ‘nuttall’]
Window type.
- norm[‘none’, ‘power’, ‘magnitude’]
Normalization type of window.
- Returns:
- outTensor [shape=(…, T)]
Waveform.