Ignore:
Timestamp:
Nov 21, 2007, 12:01:22 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:
862d78f
Parents:
ec2fa2a
Message:

onsetdection.{c,h}: add spectral flux (L2 norm, only energy increases)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/onsetdetection.c

    rec2fa2a rfabb7cd  
    196196}
    197197
     198/* Spectral flux */
     199void aubio_onsetdetection_specflux(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset){
     200  uint_t i, j;
     201  for (i=0;i<fftgrain->channels;i++) {
     202    onset->data[i][0] = 0.;
     203    for (j=0;j<fftgrain->length;j++) {
     204      if (fftgrain->norm[i][j] > o->oldmag->data[i][j])
     205        onset->data[i][0] += fftgrain->norm[i][j] - o->oldmag->data[i][j];
     206      o->oldmag->data[i][j] = fftgrain->norm[i][j];
     207    }
     208  }
     209}
     210
    198211/* Generic function pointing to the choosen one */
    199212void
     
    243256    case aubio_onset_kl:
    244257    case aubio_onset_mkl:
     258    case aubio_onset_specflux:
    245259      o->oldmag = new_fvec(rsize,channels);
    246260      break;
     
    274288    case aubio_onset_mkl:
    275289      o->funcpointer = aubio_onsetdetection_mkl;
     290      break;
     291    case aubio_onset_specflux:
     292      o->funcpointer = aubio_onsetdetection_specflux;
    276293      break;
    277294    default:
Note: See TracChangeset for help on using the changeset viewer.