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 [scalar]
Order of line spectral pairs, \(M\).
- fft_lengthint >= 1 [scalar]
Number of FFT bins, \(L\).
- alphafloat [-1 < alpha < 1]
Warping factor, \(\alpha\).
- gammafloat [-1 <= gamma < 0]
Gamma, \(\gamma\).
- log_gainbool [scalar]
If True, assume input gain is in log scale.
- out_format[‘db’, ‘log-magnitude’, ‘magnitude’, ‘power’]
Output format.
- forward(w)[source]#
Convert line spectral pairs to spectrum.
- Parameters:
- wTensor [shape=(…, M+1)]
Line spectral pairs in radians.
- Returns:
- spTensor [shape=(…, L/2+1)]
Amplitude 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])
See also