- Timestamp:
- Jan 8, 2019, 4:50:03 PM (6 years ago)
- Branches:
- feature/crepe_org
- Children:
- 18278232
- Parents:
- e85f35d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitch/pitch.c
re85f35d r84f369c 49 49 aubio_pitcht_yinfast, /**< `yinfast`, YIN fast */ 50 50 aubio_pitcht_specacf, /**< `specacf`, Spectral autocorrelation */ 51 aubio_pitcht_crepe, /**< `crepe`, convolutional neural network */ 51 52 aubio_pitcht_default 52 53 = aubio_pitcht_yinfft, /**< `default` */ … … 99 100 static void aubio_pitch_do_yinfast (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf); 100 101 static void aubio_pitch_do_specacf (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf); 102 static void aubio_pitch_do_crepe (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf); 101 103 102 104 /* internal functions for frequency conversion */ … … 104 106 static smpl_t freqconvmidi (smpl_t f, uint_t samplerate, uint_t bufsize); 105 107 static smpl_t freqconvpass (smpl_t f, uint_t samplerate, uint_t bufsize); 108 109 typedef struct _aubio_pitch_crepe_t aubio_pitch_crepe_t; 110 extern aubio_pitch_crepe_t *new_aubio_pitch_crepe(void); 111 extern void aubio_pitch_crepe_do(aubio_pitch_crepe_t *t, fvec_t *input, fvec_t *out); 112 extern void del_aubio_pitch_crepe(aubio_pitch_crepe_t *t); 113 extern smpl_t aubio_pitch_crepe_get_confidence (aubio_pitch_crepe_t * o); 114 uint_t aubio_pitch_crepe_set_tolerance(aubio_pitch_crepe_t * o, smpl_t 115 tolerance); 116 smpl_t aubio_pitch_crepe_get_tolerance (aubio_pitch_crepe_t * o); 106 117 107 118 /* adapter to stack ibuf new samples at the end of buf, and trim `buf` to `bufsize` */ … … 133 144 else if (strcmp (pitch_mode, "specacf") == 0) 134 145 pitch_type = aubio_pitcht_specacf; 146 else if (strcmp (pitch_mode, "crepe") == 0) 147 pitch_type = aubio_pitcht_crepe; 135 148 else if (strcmp (pitch_mode, "default") == 0) 136 149 pitch_type = aubio_pitcht_default; … … 214 227 aubio_pitchspecacf_set_tolerance (p->p_object, 0.85); 215 228 break; 229 case aubio_pitcht_crepe: 230 p->buf = new_fvec (bufsize); 231 p->p_object = new_aubio_pitch_crepe(); 232 if (!p->p_object) goto beach; 233 p->detect_cb = aubio_pitch_do_crepe; 234 p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitch_crepe_get_confidence; 235 //aubio_pitch_crepe_set_tolerance (p->p_object, 0.85); 236 break; 216 237 default: 217 238 break; … … 260 281 del_fvec (p->buf); 261 282 del_aubio_pitchspecacf (p->p_object); 283 break; 284 case aubio_pitcht_crepe: 285 del_fvec (p->buf); 286 del_aubio_pitch_crepe (p->p_object); 262 287 break; 263 288 default: … … 350 375 aubio_pitchyinfast_set_tolerance (p->p_object, tol); 351 376 break; 377 case aubio_pitcht_crepe: 378 aubio_pitch_crepe_set_tolerance (p->p_object, tol); 379 break; 352 380 default: 353 381 break; … … 369 397 case aubio_pitcht_yinfast: 370 398 tolerance = aubio_pitchyinfast_get_tolerance (p->p_object); 399 break; 400 case aubio_pitcht_crepe: 401 tolerance = aubio_pitch_crepe_get_tolerance (p->p_object); 371 402 break; 372 403 default: … … 479 510 480 511 void 512 aubio_pitch_do_crepe (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * out) 513 { 514 //smpl_t pitch = 0., period; 515 aubio_pitch_slideblock (p, ibuf); 516 aubio_pitch_crepe_do(p->p_object, p->buf, out); 517 out->data[0] = aubio_miditofreq(out->data[0]); 518 } 519 520 void 481 521 aubio_pitch_do_fcomb (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * out) 482 522 {
Note: See TracChangeset
for help on using the changeset viewer.