- Timestamp:
- Mar 11, 2013, 1:15:47 AM (12 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:
- 426e6f7
- Parents:
- 8c4560e
- Location:
- src/pitch
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitch/pitch.c
r8c4560e r5284e0d 62 62 (smpl_t value, uint_t srate, uint_t bufsize); 63 63 64 typedef smpl_t (*aubio_conf_cb_t) (void * p); 65 64 66 void aubio_pitch_slideblock (aubio_pitch_t * p, fvec_t * ibuf); 65 67 66 void aubio_pitch_do_mcomb (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf);67 void aubio_pitch_do_yin (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf);68 void aubio_pitch_do_schmitt (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf);69 void aubio_pitch_do_fcomb (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf);70 void aubio_pitch_do_yinfft (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf);68 static void aubio_pitch_do_mcomb (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf); 69 static void aubio_pitch_do_yin (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf); 70 static void aubio_pitch_do_schmitt (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf); 71 static void aubio_pitch_do_fcomb (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf); 72 static void aubio_pitch_do_yinfft (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf); 71 73 72 74 /** generic pitch detection structure */ … … 82 84 aubio_pitchyinfft_t *yinfft; /**< yinfft object */ 83 85 aubio_pitchyin_t *yin; /**< yinfft object */ 86 void *pitch; 84 87 aubio_filter_t *filter; /**< filter */ 85 88 aubio_pvoc_t *pv; /**< phase vocoder for mcomb */ … … 88 91 aubio_pitch_func_t callback; /**< pointer to current pitch detection method */ 89 92 aubio_pitch_conv_t freqconv; /**< pointer to current pitch conversion method */ 93 aubio_conf_cb_t confidence_callback; /**< pointer to the current confidence callback */ 90 94 }; 91 95 … … 140 144 aubio_pitch_set_unit (p, "default"); 141 145 p->bufsize = bufsize; 146 p->confidence_callback = NULL; 142 147 switch (p->type) { 143 148 case aubio_pitcht_yin: … … 145 150 p->yin = new_aubio_pitchyin (bufsize); 146 151 p->callback = aubio_pitch_do_yin; 152 p->confidence_callback = (aubio_conf_cb_t)aubio_pitchyin_get_confidence; 153 p->pitch = (void*)p->yin; 147 154 aubio_pitchyin_set_tolerance (p->yin, 0.15); 148 155 break; … … 168 175 p->yinfft = new_aubio_pitchyinfft (bufsize); 169 176 p->callback = aubio_pitch_do_yinfft; 177 p->confidence_callback = (aubio_conf_cb_t)aubio_pitchyinfft_get_confidence; 178 p->pitch = (void*)p->yin; 170 179 aubio_pitchyinfft_set_tolerance (p->yinfft, 0.85); 171 180 break; … … 345 354 out->data[0] = pitch; 346 355 } 356 357 /* confidence callbacks */ 358 smpl_t 359 aubio_pitch_get_confidence (aubio_pitch_t * p) 360 { 361 if (p->confidence_callback) { 362 return p->confidence_callback ((void*)(p->pitch)); 363 } 364 return 0.; 365 } -
src/pitch/pitchyin.c
r8c4560e r5284e0d 37 37 fvec_t *yin; 38 38 smpl_t tol; 39 smpl_t confidence; 39 40 }; 40 41 … … 159 160 } 160 161 162 smpl_t 163 aubio_pitchyin_get_confidence (aubio_pitchyin_t * o) { 164 o->confidence = 1. - fvec_min (o->yin); 165 return o->confidence; 166 } 167 161 168 uint_t 162 169 aubio_pitchyin_set_tolerance (aubio_pitchyin_t * o, smpl_t tol) -
src/pitch/pitchyin.h
r8c4560e r5284e0d 85 85 smpl_t aubio_pitchyin_get_tolerance (aubio_pitchyin_t * o); 86 86 87 /** get current confidence of YIN algorithm 88 89 \param o YIN pitch detection object 90 \return confidence parameter 91 92 */ 93 smpl_t aubio_pitchyin_get_confidence (aubio_pitchyin_t * o); 94 87 95 #ifdef __cplusplus 88 96 } -
src/pitch/pitchyinfft.c
r8c4560e r5284e0d 38 38 fvec_t *yinfft; /**< Yin function */ 39 39 smpl_t tol; /**< Yin tolerance */ 40 smpl_t confidence; /**< confidence */ 40 41 }; 41 42 … … 166 167 } 167 168 169 smpl_t 170 aubio_pitchyinfft_get_confidence (aubio_pitchyinfft_t * o) { 171 o->confidence = 1. - fvec_min (o->yinfft); 172 return o->confidence; 173 } 174 168 175 uint_t 169 176 aubio_pitchyinfft_set_tolerance (aubio_pitchyinfft_t * p, smpl_t tol) -
src/pitch/pitchyinfft.h
r8c4560e r5284e0d 84 84 uint_t aubio_pitchyinfft_set_tolerance (aubio_pitchyinfft_t * o, smpl_t tol); 85 85 86 /** get current confidence of YIN algorithm 87 88 \param o YIN pitch detection object 89 \return confidence parameter 90 91 */ 92 smpl_t aubio_pitchyinfft_get_confidence (aubio_pitchyinfft_t * o); 93 86 94 #ifdef __cplusplus 87 95 }
Note: See TracChangeset
for help on using the changeset viewer.