dct#

diffsptk.DCT#

alias of DiscreteCosineTransform

class diffsptk.DiscreteCosineTransform(dct_length)[source]#

See this page for details.

Parameters:
dct_lengthint >= 1 [scalar]

DCT length, \(L\).

forward(x)[source]#

Apply DCT to input.

Parameters:
xTensor [shape=(…, L)]

Input.

Returns:
yTensor [shape=(…, L)]

DCT output.

Examples

>>> x = diffsptk.ramp(3)
>>> dct = diffsptk.DCT(4)
>>> y = dct(x)
>>> y
tensor([ 3.0000, -2.2304,  0.0000, -0.1585])

See also

idct