zcross

Functions

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

zcross [ option ] [ infile ]

  • -l int

    • frame length (1L)

  • -o int

    • output format

      • 0 number of zero-crossings

      • 1 zero-crossing rate

  • infile str

    • double-type data sequence

  • stdout

    • double-type zero-crossing

nrand -s 0 -l 30 | zcross -l 10 | x2x +da
# 3, 2, 5
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

class ZeroCrossingAnalysis

Perform zero-crossing analysis.

The input is the L-length waveform signals:

x(0),x(1),,x(L1),
and the output is the number of zero-crossings calculated by
12l=0L1|sgn(x(l))sgn(x(l1))|.
where sgn() returns -1 if the input is negative, otherwise returns 1. Note that x(1) is taken from the previous frame.

Public Functions

explicit ZeroCrossingAnalysis(int frame_length)
Parameters:

frame_length[in] Frame length in points, L.

inline int GetFrameLength() const
Returns:

Frame length.

inline bool IsValid() const
Returns:

True if this object is valid.

bool Run(const std::vector<double> &signals, int *num_zero_crossing, ZeroCrossingAnalysis::Buffer *buffer) const
Parameters:
  • signals[in] L-length waveform signals.

  • num_zero_crossing[out] Number of zero crossings.

  • buffer[inout] Buffer.

Returns:

True on success, false on failure.

class Buffer

Buffer for ZeroCrossingAnalysis class.