Ignore:
Timestamp:
Nov 5, 2009, 11:17:56 PM (14 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:
e5b9a46
Parents:
48b6a52
Message:

src/onset/peakpick.h: remove unused functions, fix aubio_peakpicker_get_thresholded_input

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/onset/peakpick.c

    r48b6a52 r6e57c2e  
    2626#include "temporal/biquad.h"
    2727#include "onset/peakpick.h"
     28
     29/** function pointer to thresholding function */
     30typedef smpl_t (*aubio_thresholdfn_t)(fvec_t *input, uint_t channel);
     31/** function pointer to peak-picking function */
     32typedef uint_t (*aubio_pickerfn_t)(fvec_t *input, uint_t pos);
     33
     34/** set peak picker thresholding function */
     35uint_t aubio_peakpicker_set_thresholdfn(aubio_peakpicker_t * p, aubio_thresholdfn_t thresholdfn);
     36/** get peak picker thresholding function */
     37aubio_thresholdfn_t aubio_peakpicker_get_thresholdfn(aubio_peakpicker_t * p);
    2838
    2939/* peak picking parameters, default values in brackets
     
    5464        /** peak picked window [3] */
    5565  fvec_t *onset_peek;
     66        /** thresholded function */
     67  fvec_t *thresholded;
    5668        /** scratch pad for biquad and median */
    5769  fvec_t *scratch;
     
    8193  fvec_t *onset_proc = p->onset_proc;
    8294  fvec_t *onset_peek = p->onset_peek;
     95  fvec_t *thresholded = p->thresholded;
    8396  fvec_t *scratch = p->scratch;
    8497  smpl_t mean = 0., median = 0.;
     
    112125    for (j = 0; j < 3 - 1; j++)
    113126      onset_peek->data[i][j] = onset_peek->data[i][j + 1];
    114     /* calculate new peek value */
    115     onset_peek->data[i][2] =
     127    /* calculate new tresholded value */
     128    thresholded->data[i][0] =
    116129        onset_proc->data[i][p->win_post] - median - mean * p->threshold;
     130    onset_peek->data[i][2] = thresholded->data[i][0];
    117131    out->data[i][0] = (p->pickerfn) (onset_peek, 1);
    118132    if (out->data[i][0]) {
     
    125139 * after smoothing
    126140 */
    127 smpl_t
     141fvec_t *
    128142aubio_peakpicker_get_thresholded_input (aubio_peakpicker_t * p)
    129143{
    130   return p->onset_peek->data[0][1];
     144  return p->thresholded;
    131145}
    132146
     
    175189  t->onset_proc = new_fvec (t->win_post + t->win_pre + 1, channels);
    176190  t->onset_peek = new_fvec (3, channels);
     191  t->thresholded = new_fvec (1, channels);
    177192
    178193  /* cutoff: low-pass filter with cutoff reduced frequency at 0.34
     
    192207  del_fvec (p->onset_proc);
    193208  del_fvec (p->onset_peek);
     209  del_fvec (p->thresholded);
    194210  del_fvec (p->scratch);
    195211  AUBIO_FREE (p);
Note: See TracChangeset for help on using the changeset viewer.