dct#

diffsptk.DCT#

alias of DiscreteCosineTransform

class diffsptk.DiscreteCosineTransform(dct_length)[source]#

See this page for details.

Parameters:
dct_lengthint >= 1

DCT length, \(L\).

forward(x)[source]#

Apply DCT to input.

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

Input.

Returns:
outTensor [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])
diffsptk.functional.dct(x)[source]#

Compute DCT.

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

Input signal.

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

DCT output.

See also

idct