freqt2#
- class diffsptk.SecondOrderAllPassFrequencyTransform(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 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 frequency transform.
- Parameters:
- cTensor [shape=(…, M1+1)]
The input sequence.
- Returns:
- outTensor [shape=(…, M2+1)]
The warped sequence.
Examples
>>> import diffsptk >>> import torch >>> freqt2 = diffsptk.SecondOrderAllPassFrequencyTransform( ... 3, 4, alpha=0.1, theta=0.3 ... ) >>> c1 = torch.tensor([0.8, 0.6, -1.0, -0.5]) >>> c2 = freqt2(c1) >>> c2 tensor([ 0.8388, 0.4785, -1.1090, -0.3654, 0.0682])
- diffsptk.functional.freqt2(c: Tensor, out_order: int, alpha: float = 0, theta: float = 0, n_fft: int = 512) Tensor[source]#
Perform second-order all-pass 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. The accurate conversion requires the large value.
- Returns:
- outTensor [shape=(…, M2+1)]
The warped cepstral coefficients.