Changeset 6e57c2e for src


Ignore:
Timestamp:
Nov 5, 2009, 11:17:56 PM (15 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

Location:
src/onset
Files:
2 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);
  • src/onset/peakpick.h

    r48b6a52 r6e57c2e  
    3232#endif
    3333
    34 /** function pointer to thresholding function */
    35 typedef smpl_t (*aubio_thresholdfn_t)(fvec_t *input, uint_t channel);
    36 /** function pointer to peak-picking function */
    37 typedef uint_t (*aubio_pickerfn_t)(fvec_t *input, uint_t pos);
    3834/** peak-picker structure */
    3935typedef struct _aubio_peakpicker_t aubio_peakpicker_t;
     
    4339/** real time peak picking function */
    4440void aubio_peakpicker_do(aubio_peakpicker_t * p, fvec_t * in, fvec_t * out);
    45 /** get current peak value */
    46 smpl_t aubio_peakpicker_get_thresholded_input(aubio_peakpicker_t * p);
    4741/** destroy peak picker structure */
    4842void del_aubio_peakpicker(aubio_peakpicker_t * p);
    4943
     44/** get current peak value */
     45fvec_t *aubio_peakpicker_get_thresholded_input (aubio_peakpicker_t * p);
    5046/** set peak picking threshold */
    5147uint_t aubio_peakpicker_set_threshold(aubio_peakpicker_t * p, smpl_t threshold);
    5248/** get peak picking threshold */
    5349smpl_t aubio_peakpicker_get_threshold(aubio_peakpicker_t * p);
    54 /** set peak picker thresholding function */
    55 uint_t aubio_peakpicker_set_thresholdfn(aubio_peakpicker_t * p, aubio_thresholdfn_t thresholdfn);
    56 /** get peak picker thresholding function */
    57 aubio_thresholdfn_t aubio_peakpicker_get_thresholdfn(aubio_peakpicker_t * p);
    5850
    5951#ifdef __cplusplus
Note: See TracChangeset for help on using the changeset viewer.