Changeset e149aa9


Ignore:
Timestamp:
Mar 10, 2017, 5:18:25 PM (7 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, sampler
Children:
2410d3d2
Parents:
ee8a57c
Message:

src/onset/peakpicker.c: simplify using fvec_foo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/onset/peakpicker.c

    ree8a57c re149aa9  
    9393  fvec_t *scratch = p->scratch;
    9494  smpl_t mean = 0., median = 0.;
    95   uint_t length = p->win_post + p->win_pre + 1;
    9695  uint_t j = 0;
    9796
    98   /* store onset in onset_keep */
    99   /* shift all elements but last, then write last */
    100   for (j = 0; j < length - 1; j++) {
    101     onset_keep->data[j] = onset_keep->data[j + 1];
    102     onset_proc->data[j] = onset_keep->data[j];
    103   }
    104   onset_keep->data[length - 1] = onset->data[0];
    105   onset_proc->data[length - 1] = onset->data[0];
     97  /* push new novelty to the end */
     98  fvec_push(onset_keep, onset->data[0]);
     99  /* store a copy */
     100  fvec_copy(onset_keep, onset_proc);
    106101
    107   /* filter onset_proc */
    108   /** \bug filtfilt calculated post+pre times, should be only once !? */
     102  /* filter this copy */
    109103  aubio_filter_do_filtfilt (p->biquad, onset_proc, scratch);
    110104
    111105  /* calculate mean and median for onset_proc */
    112106  mean = fvec_mean (onset_proc);
    113   /* copy to scratch */
    114   for (j = 0; j < length; j++)
    115     scratch->data[j] = onset_proc->data[j];
     107
     108  /* copy to scratch and compute its median */
     109  fvec_copy(onset_proc, scratch);
    116110  median = p->thresholdfn (scratch);
    117111
Note: See TracChangeset for help on using the changeset viewer.