Skip to main content

zerocrossingrate

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

Generates an 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.

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.view('before analysis');
$buffer = $buffer.analyze($descr); ## apply analysis
$buffer.view('after analysis')