lsp2sp#

class diffsptk.LineSpectralPairsToSpectrum(lsp_order, fft_length, alpha=0, gamma=-1, log_gain=False, out_format='power')[source]#

See this page for details.

Parameters:
lsp_orderint >= 0

The order of the line spectral pairs, \(M\).

fft_lengthint >= 2

The number of FFT bins, \(L\).

alphafloat in (-1, 1)

The warping factor, \(\alpha\).

gammafloat in [-1, 0)

The gamma parameter, \(\gamma\).

log_gainbool

If True, assume the input gain is in logarithmic scale.

out_format[‘db’, ‘log-magnitude’, ‘magnitude’, ‘power’]

The output format.

References

[1]

A. V. Oppenheim et al., “Discrete representation of signals,” Proceedings of the IEEE, vol. 60, no. 6, pp. 681-691, 1972.

[2]

N. Sugamura et al., “Speech data compression by LSP speech analysis-synthesis technique,” IEICE trans, vol. J64-A, no. 8, pp. 599-606, 1981.

forward(w)[source]#

Convert line spectral pairs to spectrum.

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

The line spectral pairs in radians.

Returns:
outTensor [shape=(…, L/2+1)]

The spectrum.

Examples

>>> x = diffsptk.nrand(4)
>>> x
tensor([ 2.1110, -1.4767,  1.2490,  2.4201,  1.5429])
>>> lpc = diffsptk.LPC(3, 5)
>>> a = lpc(x)
>>> lpc2lsp = diffsptk.LinearPredictiveCoefficientsToLineSpectralPairs(3)
>>> w = lpc2lsp(a)
>>> lsp2sp = diffsptk.LineSpectralPairsToSpectrum(3, 8)
>>> sp = lsp2sp(w)
>>> sp
tensor([31.3541, 13.7932, 14.7454, 16.9510, 10.4759])
diffsptk.functional.lsp2sp(w, fft_length, alpha=0, gamma=-1, log_gain=False, out_format='power')[source]#

Convert line spectral pairs to spectrum.

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

The line spectral pairs in radians.

fft_lengthint >= 2

The number of FFT bins, \(L\).

alphafloat in (-1, 1)

The warping factor, \(\alpha\).

gammafloat in [-1, 0)

The gamma parameter, \(\gamma\).

log_gainbool

If True, assume the input gain is in logarithmic scale.

out_format[‘db’, ‘log-magnitude’, ‘magnitude’, ‘power’]

The output format.

Returns:
outTensor [shape=(…, L/2+1)]

The spectrum.

See also

lpc2lsp