c2ndps

Functions

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

c2ndps [ option ] [ infile ]

  • -m int

    • order of cepstrum \((0 \le M \le L/2)\)

  • -l int

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

  • infile str

    • double-type cepstrum

  • stdout

    • double-type NDPS

Parameters
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns

0 on success, 1 on failure.

See also

ndps2c

class sptk::CepstrumToNegativeDerivativeOfPhaseSpectrum

Convert cepstral coefficients to negative derivative of phase spectrum.

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

\[ \begin{array}{cccc} c(0), & c(1), & \ldots, & c(M), \end{array} \]
and the output is the \((L/2+1)\)-length NDPS:
\[ \begin{array}{cccc} n(0), & n(1), & \ldots, & n(L/2+1), \end{array} \]
where \(L\) must be a power of two.

The log spectrum can be represented as

\[ \log S(\omega) = \sum_{m=0}^{M} c(m) e^{-j\omega m}. \]
It can be decomposed into the real part and imaginary part:
\[ \log |S(\omega)| + j\arg S(\omega) = \sum_{m=0}^{M} c(m) e^{-j\omega m}. \]
By differentiating the equation with respect to \(\omega\), we obtain
\[ \frac{\partial}{\partial \omega} \log |S(\omega)| +j \frac{\partial}{\partial \omega} \arg S(\omega) = -j \sum_{m=0}^{M} m \cdot c(m) e^{-j\omega m}. \]
From the imaginary part of the above equation, NDPS is obtained as
\[ -\frac{\partial}{\partial \omega} \arg S(\omega) = \sum_{m=0}^{M} m \cdot c(m) \cos(\omega m). \]
This is equivalent to the real part of the DFT of \(m\,c(m)\):
\[ n(k) = \mathrm{Re} \left[ \sum_{m=0}^{M} m \cdot c(m) e^{-j2\pi mk / L} \right]. \]
Note that \(c(0)\) is not used in the calculation.

[1] B. Yegnanarayana, “Pole-zero decomposition of speech spectra,” Signal Processing, vol. 3, no. 1, pp. 5-17, 1981.

Public Functions

CepstrumToNegativeDerivativeOfPhaseSpectrum(int num_order, int fft_length)
Parameters
  • num_order[in] Order of cepstrum, \(M\).

  • fft_length[in] Length of NDPS, \(L\).

inline int GetNumOrder() const
Returns

Order of cepstrum.

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> *negative_derivative_of_phase_spectrum, CepstrumToNegativeDerivativeOfPhaseSpectrum::Buffer *buffer) const
Parameters
  • cepstrum[in] \(M\)-th order cepstrum.

  • negative_derivative_of_phase_spectrum[out] \((L/2+1)\)-length NDPS.

  • buffer[out] Buffer.

Returns

True on success, false on failure.

class Buffer

Buffer for CepstrumToNegativeDerivativeOfPhaseSpectrum class.