lpc2lsp#

class diffsptk.LinearPredictiveCoefficientsToLineSpectralPairs(lpc_order, log_gain=False, sample_rate=None, out_format='radian')[source]#

See this page for details.

Parameters:
lpc_orderint >= 0

Order of LPC, \(M\).

log_gainbool

If True, output gain in log scale.

sample_rateint >= 1 or None

Sample rate in Hz.

out_format[‘radian’, ‘cycle’, ‘khz’, ‘hz’]

Output format.

forward(a)[source]#

Convert LPC to LSP.

Parameters:
aTensor [shape=(…, M+1)]

LPC coefficients.

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

LSP frequencies.

Examples

>>> x = diffsptk.nrand(4)
>>> x
tensor([-1.5326,  1.0875, -1.5925,  0.6913,  1.6217])
>>> lpc = diffsptk.LPC(3, 5)
>>> a = lpc(x)
>>> a
tensor([ 2.7969,  0.3908,  0.0458, -0.0859])
>>> lpc2lsp = diffsptk.LinearPredictiveCoefficientsToLineSpectralPairs(3)
>>> w = lpc2lsp(a)
>>> w
tensor([2.7969, 0.9037, 1.8114, 2.4514])
diffsptk.functional.lpc2lsp(a, log_gain=False, sample_rate=None, out_format='radian')[source]#

Convert LPC to LSP.

Parameters:
aTensor [shape=(…, M+1)]

LPC coefficients.

log_gainbool

If True, output gain in log scale.

sample_rateint >= 1 or None

Sample rate in Hz.

out_format[‘radian’, ‘cycle’, ‘khz’, ‘hz’]

Output format.

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

LSP frequencies.