Changeset c268bf2
- Timestamp:
- May 9, 2017, 4:04:03 PM (8 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
- Children:
- 48fa81d
- Parents:
- 67b2dbcc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitch/pitch.c
r67b2dbcc rc268bf2 33 33 #include "pitch/pitchschmitt.h" 34 34 #include "pitch/pitchyinfft.h" 35 #include "pitch/pitchyinfast.h" 35 36 #include "pitch/pitchspecacf.h" 36 37 #include "pitch/pitch.h" … … 46 47 aubio_pitcht_fcomb, /**< `fcomb`, Fast comb filter */ 47 48 aubio_pitcht_yinfft, /**< `yinfft`, Spectral YIN */ 49 aubio_pitcht_yinfast, /**< `yinfast`, YIN fast */ 48 50 aubio_pitcht_specacf, /**< `specacf`, Spectral autocorrelation */ 49 51 aubio_pitcht_default … … 95 97 static void aubio_pitch_do_fcomb (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf); 96 98 static void aubio_pitch_do_yinfft (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf); 99 static void aubio_pitch_do_yinfast (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf); 97 100 static void aubio_pitch_do_specacf (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf); 98 101 … … 118 121 if (strcmp (pitch_mode, "mcomb") == 0) 119 122 pitch_type = aubio_pitcht_mcomb; 123 else if (strcmp (pitch_mode, "yinfast") == 0) 124 pitch_type = aubio_pitcht_yinfast; 120 125 else if (strcmp (pitch_mode, "yinfft") == 0) 121 126 pitch_type = aubio_pitcht_yinfft; … … 193 198 aubio_pitchyinfft_set_tolerance (p->p_object, 0.85); 194 199 break; 200 case aubio_pitcht_yinfast: 201 p->buf = new_fvec (bufsize); 202 p->p_object = new_aubio_pitchyinfast (bufsize); 203 if (!p->p_object) goto beach; 204 p->detect_cb = aubio_pitch_do_yinfast; 205 p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyinfast_get_confidence; 206 aubio_pitchyinfast_set_tolerance (p->p_object, 0.15); 207 break; 195 208 case aubio_pitcht_specacf: 196 209 p->buf = new_fvec (bufsize); … … 239 252 del_fvec (p->buf); 240 253 del_aubio_pitchyinfft (p->p_object); 254 break; 255 case aubio_pitcht_yinfast: 256 del_fvec (p->buf); 257 del_aubio_pitchyinfast (p->p_object); 241 258 break; 242 259 case aubio_pitcht_specacf: … … 330 347 aubio_pitchyinfft_set_tolerance (p->p_object, tol); 331 348 break; 349 case aubio_pitcht_yinfast: 350 aubio_pitchyinfast_set_tolerance (p->p_object, tol); 351 break; 332 352 default: 333 353 break; … … 346 366 case aubio_pitcht_yinfft: 347 367 tolerance = aubio_pitchyinfft_get_tolerance (p->p_object); 368 break; 369 case aubio_pitcht_yinfast: 370 tolerance = aubio_pitchyinfast_get_tolerance (p->p_object); 348 371 break; 349 372 default: … … 415 438 aubio_pitch_slideblock (p, ibuf); 416 439 aubio_pitchyinfft_do (p->p_object, p->buf, obuf); 440 pitch = obuf->data[0]; 441 if (pitch > 0) { 442 pitch = p->samplerate / (pitch + 0.); 443 } else { 444 pitch = 0.; 445 } 446 obuf->data[0] = pitch; 447 } 448 449 void 450 aubio_pitch_do_yinfast (aubio_pitch_t * p, const fvec_t * ibuf, fvec_t * obuf) 451 { 452 smpl_t pitch = 0.; 453 aubio_pitch_slideblock (p, ibuf); 454 aubio_pitchyinfast_do (p->p_object, p->buf, obuf); 417 455 pitch = obuf->data[0]; 418 456 if (pitch > 0) {
Note: See TracChangeset
for help on using the changeset viewer.