ifreqt2#

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

Second-order all-pass inverse frequency transform module.

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\).

thetafloat in [0, 1]

The emphasis frequency, \(\theta\).

n_fftint >> M2

The number of FFT bins. The accurate conversion requires the large value.

devicetorch.device or None

The device of this module.

dtypetorch.dtype or None

The data type of this module.

References

[1]

T. Wakako et al., “Speech spectral estimation based on expansion of log spectrum by arbitrary basis functions,” IEICE Trans, vol. J82-D-II, no. 12, pp. 2203-2211, 1999 (in Japanese).

forward(c: Tensor) Tensor[source]#

Perform second-order all-pass inverse frequency transform.

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

The warped sequence.

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

The output sequence.

Examples

>>> import diffsptk
>>> import torch
>>> freqt2 = diffsptk.SecondOrderAllPassFrequencyTransform(
...     3, 4, alpha=0.05, theta=0.3
... )
>>> ifreqt2 = diffsptk.SecondOrderAllPassInverseFrequencyTransform(
...     4, 3, alpha=0.05, theta=0.3
... )
>>> c1 = torch.tensor([0.8, 0.6, -1.0, -0.5])
>>> c2 = ifreqt2(freqt2(c1))
>>> c2
tensor([ 0.8000,  0.6000, -1.0000, -0.5000])
diffsptk.functional.ifreqt2(c: Tensor, out_order: int, alpha: float = 0, theta: float = 0, n_fft: int = 512) Tensor[source]#

Perform second-order all-pass inverse frequency transform.

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

The cepstral coefficients.

out_orderint >= 0

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

alphafloat in (-1, 1)

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

thetafloat in [0, 1]

The emphasis frequency, \(\theta\).

n_fftint >> M2

The number of FFT bins.

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

The warped cepstral coefficients.

See also

freqt freqt2 smcep