comparison src/BTrack.cpp @ 23:92ee4ace9d46 develop

Did more commenting. Added documentation.
author Adam <adamstark.uk@gmail.com>
date Sat, 25 Jan 2014 18:17:51 +0000
parents a8e3e95d14e4
children e4d5f045064d
comparison
equal deleted inserted replaced
22:a8e3e95d14e4 23:92ee4ace9d46
507 } 507 }
508 } 508 }
509 } 509 }
510 510
511 //======================================================================= 511 //=======================================================================
512 void BTrack::calculateBalancedACF(double *df_thresh) 512 void BTrack::calculateBalancedACF(double *onsetDetectionFunction)
513 { 513 {
514 int l, n = 0; 514 int l, n = 0;
515 double sum, tmp; 515 double sum, tmp;
516 516
517 // for l lags from 0-511 517 // for l lags from 0-511
520 sum = 0; 520 sum = 0;
521 521
522 // for n samples from 0 - (512-lag) 522 // for n samples from 0 - (512-lag)
523 for (n = 0;n < (512-l);n++) 523 for (n = 0;n < (512-l);n++)
524 { 524 {
525 tmp = df_thresh[n] * df_thresh[n+l]; // multiply current sample n by sample (n+l) 525 tmp = onsetDetectionFunction[n] * onsetDetectionFunction[n+l]; // multiply current sample n by sample (n+l)
526 sum = sum + tmp; // add to sum 526 sum = sum + tmp; // add to sum
527 } 527 }
528 528
529 acf[l] = sum / (512-l); // weight by number of mults and add to acf buffer 529 acf[l] = sum / (512-l); // weight by number of mults and add to acf buffer
530 } 530 }