c2acr

Functions

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

c2acr [ option ] [ infile ]

  • -m int

    • order of cepstral coefficients \((0 \le M_1 < L)\)

  • -M int

    • order of autocorrelation coefficients \((0 \le M_2 < L)\)

  • -l int

    • FFT length \((2 \le L)\)

  • infile str

    • double-type cepstral coefficients

  • stdout

    • double-type autocorrelation coefficients

The following example converts the 30-th order cepstral coefficients in data.cep into the 15-th order LPC coefficients.

c2acr -m 30 -M 15 < data.cep | levdur -m 15 > data.lpc

Parameters
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns

0 on success, 1 on failure.

See also

lpc2c acorr

class sptk::CepstrumToAutocorrelation

Convert cepstral coefficients to autocorrelation coefficients.

The input is the \(M_1\)-th order cepstral coefficients:

\[ \begin{array}{cccc} c(0), & c(1), & \ldots, & c(M_1), \end{array} \]
and the output is the \(M_2\)-th order autocorrelation coefficients:
\[ \begin{array}{cccc} r(0), & r(1), & \ldots, & r(M_2), \end{array} \]
The definition of the cepstrum can be represented as
\[ c(m) = \mathcal{F}^{-1} \{ \log |\mathcal{F} \{x(m)\}| \}, \]
where \(x(m)\) is a signal, \(\mathcal{F}^{-1}\) and \(\mathcal{F}\) denote the DFT and the inverse DFT, respectively. From the definition, the relation between the cepstrum and the autocorrelation can be derived as follows:
\[\begin{split}\begin{eqnarray} c(m) &=& \mathcal{F}^{-1} \left\{ \frac{1}{2} \log|X(\omega)|^2 \right\} \\ &=& \mathcal{F}^{-1} \left\{ \frac{1}{2} \log \mathcal{F} \{r(m)\} \right\}, \end{eqnarray}\end{split}\]
where the Wiener–Khinchin theorem is used. Thus
\[ r(m) = \mathcal{F}^{-1} \{ \exp (2\mathcal{F} \{c(m)\}) \}. \]
Note that the imaginary part is zero.

Public Functions

CepstrumToAutocorrelation(int num_input_order, int num_output_order, int fft_length)
Parameters
  • num_input_order[in] Order of cepstral coefficients, \(M_1\).

  • num_output_order[in] Order of autocorrelation coefficients, \(M_2\).

  • fft_length[in] FFT length.

inline int GetNumInputOrder() const
Returns

Order of cepstral coefficients.

inline int GetNumOutputOrder() const
Returns

Order of autocorrelation coefficients.

inline int GetFftLength() const
Returns

FFT length.

inline bool IsValid() const
Returns

True if this object is valid.

bool Run(const std::vector<double> &cepstrum, std::vector<double> *autocorrelation, CepstrumToAutocorrelation::Buffer *buffer) const
Parameters
  • cepstrum[in] \(M_1\)-th order cesptral coefficients.

  • autocorrelation[out] \(M_2\)-th order autocorrelation coefficients.

  • buffer[out] Buffer.

Returns

True on success, false on failure.

class Buffer

Buffer for CepstrumToAutocorrelation class.