Changeset fc6c831 for src/mathutils.c


Ignore:
Timestamp:
Nov 24, 2007, 10:47:15 PM (16 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:
6c7d49b
Parents:
e2da295
Message:

moved spectral_centroid to new file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mathutils.c

    re2da295 rfc6c831  
    433433}
    434434
    435 smpl_t aubio_spectral_centroid(cvec_t * spectrum, smpl_t samplerate) {
    436   uint_t i=0, j;
    437   smpl_t sum = 0., sc = 0.;
    438   for ( j = 0; j < spectrum->length; j++ ) {
    439     sum += spectrum->norm[i][j];
    440   }
    441   if (sum == 0.) return 0.;
    442   for ( j = 0; j < spectrum->length; j++ ) {
    443     sc += (smpl_t)j * spectrum->norm[i][j];
    444   }
    445   return sc / sum * samplerate / (smpl_t)(spectrum->length);
    446 }
    447 
    448435void aubio_autocorr(fvec_t * input, fvec_t * output) {
    449436  uint_t i = 0, j = 0, length = input->length;
Note: See TracChangeset for help on using the changeset viewer.