lpc2lsp#
- class diffsptk.LinearPredictiveCoefficientsToLineSpectralPairs(lpc_order: int, log_gain: bool = False, sample_rate: int | None = None, out_format: str | int = 'radian', device: device | None = None, dtype: dtype | None = None)[source]#
See this page for details.
- Parameters:
- lpc_orderint >= 0
The order of the input LPC, \(M\).
- log_gainbool
If True, output the gain in logarithmic scale.
- sample_rateint >= 1 or None
The sample rate in Hz.
- out_format[‘radian’, ‘cycle’, ‘khz’, ‘hz’]
The output format.
- devicetorch.device or None
The device of this module.
- dtypetorch.dtype or None
The data type of this module.
References
[1]P. Kabal et al., “The computation of line spectral frequencies using Chebyshev polynomials,” IEEE Transactions on Acoustics, Speech, and Signal Processing, vol. 34, no. 6, pp. 1419-1426, 1986.
- forward(a: Tensor) Tensor [source]#
Convert LPC to LSP.
- Parameters:
- aTensor [shape=(…, M+1)]
The LPC coefficients.
- Returns:
- outTensor [shape=(…, M+1)]
The LSP frequencies.
Examples
>>> import diffsptk >>> lpc = diffsptk.LPC(5, 2) >>> lpc2lsp = diffsptk.LinearPredictiveCoefficientsToLineSpectralPairs(2) >>> x = diffsptk.ramp(1, 5) * 0.1 >>> a = lpc(x) >>> w = lpc2lsp(a) >>> w tensor([0.5054, 0.5598, 1.6042])
- diffsptk.functional.lpc2lsp(a: Tensor, log_gain: bool = False, sample_rate: int | None = None, out_format: str = 'radian') Tensor [source]#
Convert LPC to LSP.
- Parameters:
- aTensor [shape=(…, M+1)]
The LPC coefficients.
- log_gainbool
If True, output the gain in logarithmic scale.
- sample_rateint >= 1 or None
The sample rate in Hz.
- out_format[‘radian’, ‘cycle’, ‘khz’, ‘hz’]
The output format.
- Returns:
- outTensor [shape=(…, M+1)]
The LSP frequencies.