lsp2lpc

Functions

int main(int argc, char *argv[])

lsp2lpc [ option ] [ infile ]

  • -m int

    • order of coefficients \((0 \le M)\)

  • -s double

    • sampling rate \((0 < F_s)\)

  • -k int

    • input gain type

      • 0 linear gain

      • 1 log gain

      • 2 without gain

  • -q int

    • input format

      • 0 frequency in rad

      • 1 frequency in cyc

      • 2 frequency in kHz

      • 3 frequency in Hz

  • infile str

    • double-type LSP coefficients

  • stdout

    • double-type LPC coefficients

Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

lpc2lsp

class LineSpectralPairsToLinearPredictiveCoefficients

Convert line spectral pairs to linear predictive coefficients.

The input is the \(M\)-th order LSP:

\[ \begin{array}{cccc} K, & \omega(1), & \ldots, & \omega(M), \end{array} \]
and the output is the \(M\)-th order LPC:
\[ \begin{array}{cccc} K, & a(1), & \ldots, & a(M). \end{array} \]
The LSP coefficients are the roots of the following polynomials:
\[\begin{split}\begin{eqnarray} P(z)&=&(1-z^{-1})\prod_{m=2,4,\ldots}^M (1-2\cos\omega(m)z^{-1}+z^{-2}), \\ Q(z)&=&(1+z^{-1})\prod_{m=1,3,\ldots}^M (1-2\cos\omega(m)z^{-1}+z^{-2}). \end{eqnarray}\end{split}\]
The relation between the polynomials and the all-pole filter is
\[\begin{split}\begin{eqnarray} A(z) &=& 1 + \sum_{m=1}^M a(m) z^{-m} \\ &=& \displaystyle\frac{P(z) + Q(z)}{2}. \end{eqnarray}\end{split}\]
The LPC coefficients are derived from the LSP coefficients using the above relation.

Public Functions

explicit LineSpectralPairsToLinearPredictiveCoefficients(int num_order)
Parameters:

num_order[in] Order of coefficients, \(M\).

inline int GetNumOrder() const
Returns:

Order of coefficients.

inline bool IsValid() const
Returns:

True if this object is valid.

bool Run(const std::vector<double> &line_spectral_pairs, std::vector<double> *linear_predictive_coefficients, LineSpectralPairsToLinearPredictiveCoefficients::Buffer *buffer) const
Parameters:
  • line_spectral_pairs[in] \(M\)-th order LSP.

  • linear_predictive_coefficients[out] \(M\)-th order LPC.

  • buffer[out] Buffer.

Returns:

True on success, false on failure.

bool Run(std::vector<double> *input_and_output, LineSpectralPairsToLinearPredictiveCoefficients::Buffer *buffer) const
Parameters:
  • input_and_output[inout] \(M\)-th order coefficients.

  • buffer[out] Buffer.

Returns:

True on success, false on failure.

class Buffer

Buffer for LineSpectralPairsToLinearPredictiveCoefficients class.