lpc

diffsptk.LPC

alias of diffsptk.core.lpc.LinearPredictiveCodingAnalysis

class diffsptk.LinearPredictiveCodingAnalysis(acr_order, frame_length, out_format='K,a')[source]

See this page for details. This module is a simple cascade of acorr and levdur.

Parameters
acr_orderint >= 0 [scalar]

Order of autocorrelation, \(M\).

frame_lengthint > M [scalar]

Frame length, \(L\).

out_format[‘K’, ‘a’, ‘Ka’, ‘K,a’]

K is gain and a is LPC coefficients. If this is Ka, the two output tensors are concatenated and return the tensor instead of the tuple.

forward(x)[source]

Perform LPC analysis.

Parameters
xTensor [shape=(…, L)]

Framed waveform

Returns
aTensor or tuple[Tensor]

Gain and/or LPC coefficients.

Examples

>>> x = torch.nrand(5)
tensor([ 0.8226, -0.0284, -0.5715,  0.2127,  0.1217])
>>> lpc = diffsptk.LPC(2, 5)
>>> a = lpc(x)
>>> a
(tensor([0.8726]), tensor([0.1475, 0.5270]))

See also

acorr levdur