Changes in src/mathutils.c [fff2bee:0dbdb40]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mathutils.c
rfff2bee r0dbdb40 458 458 } 459 459 460 smpl_t aubio_spectral_centroid(cvec_t * spectrum, smpl_t samplerate) { 461 uint_t i=0, j; 462 smpl_t sum = 0., sc = 0.; 463 for ( j = 0; j < spectrum->length; j++ ) { 464 sum += spectrum->norm[i][j]; 465 } 466 if (sum == 0.) return 0.; 467 for ( j = 0; j < spectrum->length; j++ ) { 468 sc += (smpl_t)j * spectrum->norm[i][j]; 469 } 470 return sc / sum * samplerate / (smpl_t)(spectrum->length); 471 } 472 460 473 void aubio_autocorr(fvec_t * input, fvec_t * output){ 461 474 uint_t i = 0, j = 0, length = input->length;
Note: See TracChangeset
for help on using the changeset viewer.