cdist

Functions

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

cdist [ option ] cfile [ infile ]

  • -m int

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

  • -o int

    • output format \((0 \le O \le 2)\)

      • 0 Euclidean [dB]

      • 1 Euclidean

      • 2 squared Euclidean

  • -f

    • output distance frame-by-frame

  • cfile str

    • double-type minimum phase cepstrum

  • infile str

    • double-type minimum phase cepstrum

  • stdout

    • double-type cepstral distance

The cepsturm model can be described as

\[ \log H(e^{j\omega}) = \sum_{m=0}^M c(m) e^{-j\omega m}. \]
Let us define
\[ \log H_0(e^{j\omega}) = \sum_{m=1}^M c(m) e^{-j\omega m}, \]
where
\[ \log H_0(e^{j\omega}) = \log|H_0(e^{j\omega})| + j \arg H_0(e^{j\omega}). \]
Using the properties of complex conjugate, we obtain
\[\begin{split}\begin{eqnarray} \sum_{m=1}^M c(m) e^{-j\omega m} + \sum_{m=1}^M c(m) e^{j\omega m} &=& 2\log |H_0(e^{j\omega})| \\ \sum_{m=-M}^M \hat{c}(m) e^{-j\omega m} &=& \log |H_0(e^{j\omega})|^2 \\ \end{eqnarray}\end{split}\]
where
\[\begin{split} \hat{c}(m) = \left\{ \begin{array}{ll} c(-m), & m < 0 \\ 0, & m = 0 \\ c(m). & m > 0 \end{array} \right. \end{split}\]
The Parseval’s theorem says that the distance between two cepstral coefficients equivalents to the distance between two log spectra:
\[ \sum_{m=-M}^M (\hat{c}^{(1)}(m) - \hat{c}^{(2)}(m))^2 = \frac{1}{2\pi} \int_{-\pi}^{\pi} \left( \log|H_0^{(1)}(e^{j\omega})|^2 - \log|H_0^{(2)}(e^{j\omega})|^2 \right)^2 d\omega. \]
The Euclidean distance can be written as
\[ \sqrt{\sum_{m=-M}^M (\hat{c}^{(1)}(m) - \hat{c}^{(2)}(m))^2} = \sqrt{2 \sum_{m=1}^M (c^{(1)}(m) - c^{(2)}(m))^2}. \]
It can be converted into decibels by multipling a constant:
\[ \underbrace{\frac{10 \sqrt{2}}{\log 10}}_C \sqrt{\underbrace{\sum_{m=1}^M (c^{(1)}(m) - c^{(2)}(m))^2}_d}. \]

The input of this command is

\[\begin{split} \begin{array}{ccccc} c^{(1)}_t(0), & c^{(1)}_t(1), & \ldots, & c^{(1)}_t(M), & \ldots \\ c^{(2)}_t(0), & c^{(2)}_t(1), & \ldots, & c^{(2)}_t(M), & \ldots \end{array} \end{split}\]
and the output is
\[ \begin{array}{cccc} d'_t, & d'_{t+1}, & d'_{t+2}, & \ldots \end{array} \]
where
\[\begin{split} d'_t = \left\{ \begin{array}{cl} C \sqrt{d_t}, & (O = 0) \\ \sqrt{d_t}, & (O = 1) \\ d_t. & (O = 2) \end{array} \right. \end{split}\]
If -f option is not given, the output is the total cepstral distance between two cepstral coefficients:
\[ d' = \frac{1}{T} \sum_{t=0}^{T-1} d'_t \]
where \(T\) is the number of frames.

In the example below, the spectral distance of the 15-th order cepstrum files data1.cep and data2.cep is evaluated and displayed:

cdist -m 15 data1.cep data2.cep | dmp +d
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

amgcep mgcep rmse