Skip to main content

zerocrossingrate

zerocrossingrate(
@threshold 0
@mode 0
) -> llll

Generates audio descriptor to compute the zero-crossing rate of a buffer, defined as the number of sign changes between consecutive signal values divided by the total number of values. Noisy signals tend to have higher zero-crossing rate. In order to avoid small variations around zero caused by noise, a threshold around zero is given to consider a valid zerocrosing whenever the boundary is crossed. See analyze.

The resulting buffer will be updated with the following keys:

  • zerocrossingrate
info

zerocrossingrate is a mirror implementation of the same algorithm in the Essentia library. For more details on the algorithm, please check the Essentia Algorithms reference.


Arguments

  • @threshold [int/float]: the threshold which will be taken as the zero axis in both positive and negative sign. (default: 0).
  • @mode [int]: analysis mode. (default: 0).
    • 0: global
    • 1: time series
    • 2: time-tagged time series
    • 3: buffer

Output

zerocrossingrate descriptor [llll]


Usage

zerocrossingrate is meant to be used with the analyze function:

$buffer = importaudio('singing.wav'); ## input buffer
$descr = zerocrossingrate(); ## generate zerocrossingrate audio descriptor
$buffer.inspect('before analysis');
$buffer = $buffer.analyze($descr); ## apply analysis
$buffer.inspect('after analysis')