freqt#

class diffsptk.FrequencyTransform(in_order: int, out_order: int, alpha: float = 0, device: device | None = None, dtype: dtype | None = None)[source]#

See this page for details.

Parameters:
in_orderint >= 0

The order of the input sequence, \(M_1\).

out_orderint >= 0

The order of the output sequence, \(M_2\).

alphafloat in (-1, 1)

The frequency warping factor, \(\alpha\).

devicetorch.device or None

The device of this module.

dtypetorch.dtype or None

The data type of this module.

References

[1]

A. V. Oppenheim et al, “Discrete representation of signals,” Proceedings of the IEEE, vol. 60, no. 6, pp. 681-691, 1972.

forward(c: Tensor) Tensor[source]#

Perform frequency transform.

Parameters:
cTensor [shape=(…, M1+1)]

The input cepstral coefficients.

Returns:
outTensor [shape=(…, M2+1)]

The warped cepstral coefficients.

Examples

>>> import diffsptk
>>> freqt = diffsptk.FrequencyTransform(3, 4, 0.02)
>>> ifreqt = diffsptk.FrequencyTransform(4, 3, -0.02)
>>> c1 = diffsptk.ramp(1, 4)
>>> c1
tensor([1., 2., 3., 4.])
>>> c2 = freqt(c1)
>>> c2
tensor([ 1.0412,  2.1240,  3.1949,  3.8666, -0.2358])
>>> c3 = ifreqt(c2)
>>> c3
tensor([1.0000, 2.0000, 3.0000, 4.0000])
diffsptk.functional.freqt(c: Tensor, out_order: int, alpha: float = 0) Tensor[source]#

Perform frequency transform.

Parameters:
cTensor [shape=(…, M1+1)]

The cepstral coefficients.

out_orderint >= 0

The order of the output cepstrum, \(M_2\).

alphafloat in (-1, 1)

The frequency warping factor, \(\alpha\).

Returns:
outTensor [shape=(…, M2+1)]

The warped cepstral coefficients.

See also

mgc2mgc freqt2