Changeset 7e204d01 for src


Ignore:
Timestamp:
May 16, 2008, 12:50:38 AM (17 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
13e23b8
Parents:
cf2f1b8
Message:

src/mathutils.c: change zero crossing function to split at >=0/<0; tests/python/src/temporal/zero_crossing_rate.py: add some tests for zero crossing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mathutils.c

    rcf2f1b8 r7e204d01  
    420420  uint_t zcr = 0;
    421421  for ( j = 1; j < input->length; j++ ) {
    422     // previous was negative
    423     if( input->data[i][j-1] <= 0. ) {
    424       if ( input->data[i][j] > 0. ) {
     422    // previous was strictly negative
     423    if( input->data[i][j-1] < 0. ) {
     424      // current is positive or null
     425      if ( input->data[i][j] >= 0. ) {
    425426        zcr += 1;
    426427      }
    427     //previous was positive
    428     } else if ( input->data[i][j] <= 0. ) {
    429       zcr += 1;
     428    // previous was positive or null
     429    } else {
     430      // current is strictly negative
     431      if ( input->data[i][j] < 0. ) {
     432        zcr += 1;
     433      }
    430434    }
    431435  }
Note: See TracChangeset for help on using the changeset viewer.