acorr

Functions

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

acorr [ option ] [ infile ]

  • -l int

    • frame length \((1 \le L)\)

  • -m int

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

  • -o double

    • output format

      • 0 autocorrelation

      • 1 biased autocorrelation

      • 2 normalized autocorrelation

  • infile str

    • double-type data sequence

  • stdout

    • double-type autocorrelation sequence.

If -o 1, output the biased autocorrelation:

\[ \begin{array}{cccc} r(0)/L, & r(1)/L, & \ldots, & r(M)/L, \end{array} \]
where \(r(m)\) is the \(m\)-th autocorrelation coefficient. If -o 2, output the normalized autocorrelation:
\[ \begin{array}{cccc} 1, & r(1)/r(0), & \ldots, & r(M)/r(0). \end{array} \]

The below example extracts 10-th order autocorrelation coefficients from windowed waveform.

x2x +sd data.short | frame | window | acorr -m 10 > data.acr

Parameters
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns

0 on success, 1 on failure.

See also

c2acr levdur

class sptk::WaveformToAutocorrelation

Calculate autocorrelation.

The input is the framed waveform signal:

\[ \begin{array}{cccc} x(0), & x(1), & \ldots, & x(L-1), \end{array} \]
where \(L\) is the frame length. The output is the \(M\)-th order autocorrelation coefficients:
\[ \begin{array}{cccc} r(0), & r(1), & \ldots, & r(M). \end{array} \]
The autocorrelation is given by
\[ r(m) = \sum_{l=0}^{L-1-m} x(l)x(l+m), \]
where \(m\) is the lag.

Public Functions

WaveformToAutocorrelation(int frame_length, int num_order)
Parameters
  • frame_length[in] Frame length, \(L\).

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

inline int GetFrameLength() const
Returns

Frame length.

inline int GetNumOrder() const
Returns

Order of autocorrelation.

inline bool IsValid() const
Returns

True if this object is valid.

bool Run(const std::vector<double> &waveform, std::vector<double> *autocorrelation) const
Parameters
  • waveform[in] \(L\)-length framed waveform.

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