lspcheck#

class diffsptk.LineSpectralPairsStabilityCheck(lsp_order: int, rate: float = 0, n_iter: int = 1, warn_type: str = 'warn')[source]#

See this page for details.

Parameters:
lsp_orderint >= 0

The order of the LSP, \(M\).

ratefloat in [0, 1]

The rate of distance between two adjacent LSPs.

n_iterint >= 0

The number of iterations for the modification.

warn_type[‘ignore’, ‘warn’, ‘exit’]

The warning type.

forward(w: Tensor) Tensor[source]#

Check the stability of the input LSP coefficients.

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

The input LSP coefficients in radians.

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

The modified LSP coefficients in radians.

Examples

>>> import diffsptk
>>> import torch
>>> w1 = torch.tensor([1.0 / torch.pi, 0.0, 0.0, 0.5, 1.0]) * torch.pi
>>> lspcheck = diffsptk.LineSpectralPairsStabilityCheck(
...     4, rate=0.01, n_iter=10, warn_type="ignore"
... )
>>> w2 = lspcheck(w1)
>>> w2
tensor([1.0000, 0.0063, 0.0126, 1.5708, 3.1353])
diffsptk.functional.lspcheck(w: Tensor, rate: float = 0, n_iter: int = 1, warn_type: str = 'warn') Tensor[source]#

Check the stability of the input LSP coefficients.

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

The input LSP coefficients in radians.

ratefloat in [0, 1]

The rate of distance between two adjacent LSPs.

n_iterint >= 0

The number of iterations for the modification.

warn_type[‘ignore’, ‘warn’, ‘exit’]

The warning type.

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

The modified LSP frequencies.

See also

lpc2lsp