Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/onset/peakpicker.c

    re149aa9 r67b6618  
    9393  fvec_t *scratch = p->scratch;
    9494  smpl_t mean = 0., median = 0.;
     95  uint_t length = p->win_post + p->win_pre + 1;
    9596  uint_t j = 0;
    9697
    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);
    101 
    102   /* filter this copy */
     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];
     106
     107  /* filter onset_proc */
     108  /** \bug filtfilt calculated post+pre times, should be only once !? */
    103109  aubio_filter_do_filtfilt (p->biquad, onset_proc, scratch);
    104110
    105111  /* calculate mean and median for onset_proc */
    106112  mean = fvec_mean (onset_proc);
    107 
    108   /* copy to scratch and compute its median */
    109   fvec_copy(onset_proc, scratch);
     113  /* copy to scratch */
     114  for (j = 0; j < length; j++)
     115    scratch->data[j] = onset_proc->data[j];
    110116  median = p->thresholdfn (scratch);
    111117
Note: See TracChangeset for help on using the changeset viewer.