Skip to content

Commit

Permalink
added zero-crossing rate function
Browse files Browse the repository at this point in the history
  • Loading branch information
dariosanfilippo authored and sletz committed Jun 20, 2020
1 parent fedd4eb commit cde57d7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions analyzers.lib
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,30 @@ declare rms_envelope_t19 copyright "Copyright (C) 2020 Dario Sanfilippo
declare rms_envelope_t19 license "MIT-style STK-4.3 license";
rms_envelope_t19(period, x) = ms_envelope_t19(period, x) : sqrt;

//-----------------------`(an.)zcr`--------------------------------------------
// Zero-crossing rate (ZCR) with one-pole lowpass averaging based on the tau
// constant. It outputs an index between 0 and 1 at a desired analysis frame.
// The ZCR of a signal correlates with the noisiness [Gouyon et al. 2000] and
// the spectral centroid [Herrera-Boyer et al. 2006] of a signal.
// For sinusoidal signals, the ZCR can be multiplied by ma.SR/2 and used
// as a frequency detector. For example, it can be deployed as a
// computationally efficient adaptive mechanism for automatic Larsen
// suppression.
//
// #### Usage
//
// ```
// _ : zcr(tau) : _;
// ```
//
// Where:
//
// * `tau`: (time to decay by e^-1) sets the averaging frame in seconds.
declare zcr author "Dario Sanfilippo";
declare zcr copyright "Copyright (C) 2020 Dario Sanfilippo
<[email protected]>";
declare zcr license "MIT-style STK-4.3 license";
zcr(period, x) = ma.zc(x) : fi.lptau(period);

//=============================Spectrum-Analyzers=========================================
// Spectrum-analyzers split the input signal into a bank of parallel signals, one for
Expand Down

0 comments on commit cde57d7

Please sign in to comment.