imdct#

diffsptk.IMDCT#

alias of InverseModifiedDiscreteCosineTransform

class diffsptk.InverseModifiedDiscreteCosineTransform(frame_length, window='sine', **kwargs)[source]#

This is the opposite module to ModifiedDiscreteCosineTransform().

Parameters:
frame_lengthint >= 2

Frame length, \(L\).

window[‘sine’, ‘vorbis’, ‘kbd’, ‘rectangular’]

Window type.

forward(y, out_length=None)[source]#

Compute inverse modified discrete cosine transform.

Parameters:
yTensor [shape=(…, 2T/L, L/2)]

Spectrum.

out_lengthint or None

Length of output waveform.

Returns:
outTensor [shape=(…, T)]

Reconstructed waveform.

Examples

>>> x = diffsptk.ramp(3)
>>> x
tensor([0., 1., 2., 3.])
>>> mdct_params = {"frame_length": 4, "window": "vorbis"}
>>> mdct = diffsptk.MDCT(**mdct_params)
>>> imdct = diffsptk.IMDCT(**mdct_params)
>>> y = imdct(mdct(x))
>>> y
tensor([1.0431e-07, 1.0000e+00, 2.0000e+00, 3.0000e+00])
diffsptk.functional.imdct(y, out_length=None, frame_length=400, window='sine')[source]#

Compute inverse modified discrete cosine transform.

Parameters:
yTensor [shape=(…, 2T/L, L/2)]

Spectrum.

out_lengthint or None

Length of output waveform.

frame_lengthint >= 2

Frame length, \(L\).

window[‘sine’, ‘vorbis’, ‘kbd’, ‘rectangular’]

Window type.

See also

unframe window mdct