Changeset fabb7cd


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)

Location:
src
Files:
2 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:
  • src/onsetdetection.h

    rec2fa2a rfabb7cd  
    4848        aubio_onset_kl,             /**< Kullback Liebler */
    4949        aubio_onset_mkl,            /**< modified Kullback Liebler */
     50        aubio_onset_specflux,       /**< spectral flux */
    5051} aubio_onsetdetection_type;
    5152
     
    137138*/
    138139void aubio_onsetdetection_mkl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
     140/** Spectral Flux
     141
     142  Simon Dixon, Onset Detection Revisited, in ``Proceedings of the 9th
     143  International Conference on Digital Audio Effects'' (DAFx-06), Montreal,
     144  Canada, 2006.
     145
     146  \param o onset detection object as returned by new_aubio_onsetdetection()
     147  \param fftgrain input spectral frame
     148  \param onset output onset detection function
     149
     150*/
     151void aubio_onsetdetection_specflux(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
    139152/** execute onset detection function on a spectral frame
    140153
Note: See TracChangeset for help on using the changeset viewer.