levdur
Functions
-
int main(int argc, char *argv[])
levdur [ option ] [ infile ]
-m int
order of coefficients \((0 \le M)\)
-e int
warning type
0
no warning1
output index2
output index and exit immediately
infile str
double-type autocorrelation
stdout
double-type linear predictive coefficients
The below example calculates the LPC coefficients of
data.d
.frame < data.d | window | acorr -m 20 | levdur -m 20 > data.lpc
- Parameters:
argc – [in] Number of arguments.
argv – [in] Argument vector.
- Returns:
0 on success, 1 on failure.
-
class LevinsonDurbinRecursion
Calculate linear predictive coefficients from autocorrelation.
The input is the \(M\)-th order autocorrelation:
\[ \begin{array}{cccc} r(0), & r(1), & \ldots, & r(M), \end{array} \]and the output is the \(M\)-th order LPC coefficients:\[ \begin{array}{cccc} K, & a(1), & \ldots, & a(M), \end{array} \]where \(K\) is the gain. The LPC coefficients are obtained by solving the following set of linear equations:\[\begin{split} \left[ \begin{array}{cccc} r(0) & r(1) & \cdots & r(M-1) \\ r(1) & r(0) & \cdots & r(M-2) \\ \vdots & \vdots & \ddots & \vdots \\ r(M-1) & r(M-2) & \cdots & r(0) \end{array} \right] \left[ \begin{array}{c} a(1) \\ a(2) \\ \vdots \\ a(M) \end{array} \right] = - \left[ \begin{array}{c} r(1) \\ r(2) \\ \vdots \\ r(M) \end{array} \right]. \end{split}\]The Durbin iterative and efficient algorithm is used to solve the above system by taking the addvantage of the Toeplitz characteristic of the autocorrelation matrix:\[\begin{split}\begin{eqnarray} k(i) &=& \frac{-r(i)-\displaystyle\sum_{j=1}^i a^{(i-1)}(j)r(i-j)} {E^{(i-1)}}, \\ a^{(i)}(j) &=& a^{(i-1)}(j) + k(i) a^{(i-1)}(i-j), \quad (1 \le j < i) \\ a^{(i)}(i) &=& k(i), \\ E^{(i)} &=& (1-k^2(i)) E^{(i-1)}, \\ && \qquad \qquad \qquad \qquad i = 1,2,\ldots,M \end{eqnarray}\end{split}\]where the initial condition is \(E^{(0)} = r(0)\) and \(a^{(0)}(1) = 0\). The gain \(K\) is calculated as\[ K = \sqrt{E^{(M)}}. \]Public Functions
-
explicit LevinsonDurbinRecursion(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> &autocorrelation, std::vector<double> *linear_predictive_coefficients, bool *is_stable, LevinsonDurbinRecursion::Buffer *buffer) const
- Parameters:
autocorrelation – [in] \(M\)-th order autocorrelation.
linear_predictive_coefficients – [out] \(M\)-th order LPC coefficients.
is_stable – [out] True if the obtained coefficients are stable.
buffer – [out] Buffer.
- Returns:
True on success, false on failure.
-
bool Run(std::vector<double> *input_and_output, bool *is_stable, LevinsonDurbinRecursion::Buffer *buffer) const
- Parameters:
input_and_output – [inout] \(M\)-th order coefficients.
is_stable – [out] True if the obtained coefficients are stable.
buffer – [out] Buffer.
- Returns:
True on success, false on failure.
-
class Buffer
Buffer for LevinsonDurbinRecursion class.
-
explicit LevinsonDurbinRecursion(int num_order)