Changeset 6e57c2e for src/onset/peakpick.c
 Timestamp:
 Nov 5, 2009, 11:17:56 PM (15 years ago)
 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
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/onset/peakpick.c
r48b6a52 r6e57c2e 26 26 #include "temporal/biquad.h" 27 27 #include "onset/peakpick.h" 28 29 /** function pointer to thresholding function */ 30 typedef smpl_t (*aubio_thresholdfn_t)(fvec_t *input, uint_t channel); 31 /** function pointer to peakpicking function */ 32 typedef uint_t (*aubio_pickerfn_t)(fvec_t *input, uint_t pos); 33 34 /** set peak picker thresholding function */ 35 uint_t aubio_peakpicker_set_thresholdfn(aubio_peakpicker_t * p, aubio_thresholdfn_t thresholdfn); 36 /** get peak picker thresholding function */ 37 aubio_thresholdfn_t aubio_peakpicker_get_thresholdfn(aubio_peakpicker_t * p); 28 38 29 39 /* peak picking parameters, default values in brackets … … 54 64 /** peak picked window [3] */ 55 65 fvec_t *onset_peek; 66 /** thresholded function */ 67 fvec_t *thresholded; 56 68 /** scratch pad for biquad and median */ 57 69 fvec_t *scratch; … … 81 93 fvec_t *onset_proc = p>onset_proc; 82 94 fvec_t *onset_peek = p>onset_peek; 95 fvec_t *thresholded = p>thresholded; 83 96 fvec_t *scratch = p>scratch; 84 97 smpl_t mean = 0., median = 0.; … … 112 125 for (j = 0; j < 3  1; j++) 113 126 onset_peek>data[i][j] = onset_peek>data[i][j + 1]; 114 /* calculate new peekvalue */115 onset_peek>data[i][2] =127 /* calculate new tresholded value */ 128 thresholded>data[i][0] = 116 129 onset_proc>data[i][p>win_post]  median  mean * p>threshold; 130 onset_peek>data[i][2] = thresholded>data[i][0]; 117 131 out>data[i][0] = (p>pickerfn) (onset_peek, 1); 118 132 if (out>data[i][0]) { … … 125 139 * after smoothing 126 140 */ 127 smpl_t 141 fvec_t * 128 142 aubio_peakpicker_get_thresholded_input (aubio_peakpicker_t * p) 129 143 { 130 return p> onset_peek>data[0][1];144 return p>thresholded; 131 145 } 132 146 … … 175 189 t>onset_proc = new_fvec (t>win_post + t>win_pre + 1, channels); 176 190 t>onset_peek = new_fvec (3, channels); 191 t>thresholded = new_fvec (1, channels); 177 192 178 193 /* cutoff: lowpass filter with cutoff reduced frequency at 0.34 … … 192 207 del_fvec (p>onset_proc); 193 208 del_fvec (p>onset_peek); 209 del_fvec (p>thresholded); 194 210 del_fvec (p>scratch); 195 211 AUBIO_FREE (p);
Note: See TracChangeset
for help on using the changeset viewer.