lpc#

diffsptk.LPC#

alias of LinearPredictiveCodingAnalysis

class diffsptk.LinearPredictiveCodingAnalysis(frame_length: int, lpc_order: int, eps: float | None = None, device: device | None = None, dtype: dtype | None = None)[source]#

See this page for details. Double precision is recommended.

Parameters:
frame_lengthint > M

The frame length, \(L\).

lpc_orderint >= 0

The order of the LPC coefficients, \(M\).

epsfloat >= 0 or None

A small value to improve numerical stability. If None, automatically set based on the data type.

devicetorch.device or None

The device of this module.

dtypetorch.dtype or None

The data type of this module.

forward(x: Tensor) Tensor[source]#

Perform LPC analysis.

Parameters:
xTensor [shape=(…, L)]

The framed waveform.

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

The gain and LPC coefficients.

Examples

>>> import diffsptk
>>> lpc = diffsptk.LPC(5, 2)
>>> x = diffsptk.ramp(1, 5) * 0.1
>>> a = lpc(x)
>>> a
tensor([ 0.5054, -0.8140,  0.1193])
diffsptk.functional.lpc(x: Tensor, lpc_order: int, eps: float | None = None) Tensor[source]#

Perform LPC analysis.

Parameters:
xTensor [shape=(…, L)]

The famed waveform.

lpc_orderint >= 0

The order of the LPC coefficients, \(M\).

epsfloat >= 0 or None

A small value to improve numerical stability. If None, automatically set based on the input data type.

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

The gain and LPC coefficients.