Changeset 95dc7f2
- Timestamp:
- Apr 8, 2013, 6:50:55 PM (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:
- 0e75589
- Parents:
- ea912cc
- Location:
- src/pitch
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitch/pitch.c
rea912cc r95dc7f2 33 33 #include "pitch/pitchschmitt.h" 34 34 #include "pitch/pitchyinfft.h" 35 #include "pitch/pitchspecacf.h" 35 36 #include "pitch/pitch.h" 36 37 … … 43 44 aubio_pitcht_fcomb, /**< `fcomb`, Fast comb filter */ 44 45 aubio_pitcht_yinfft, /**< `yinfft`, Spectral YIN */ 46 aubio_pitcht_specacf, /**< `specacf`, Spectral autocorrelation */ 45 47 aubio_pitcht_default 46 48 = aubio_pitcht_yinfft, /**< `default` */ … … 89 91 static void aubio_pitch_do_fcomb (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf); 90 92 static void aubio_pitch_do_yinfft (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf); 93 static void aubio_pitch_do_specacf (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf); 91 94 92 95 /* conversion functions for frequency conversions */ … … 115 118 else if (strcmp (pitch_mode, "fcomb") == 0) 116 119 pitch_type = aubio_pitcht_fcomb; 120 else if (strcmp (pitch_mode, "specacf") == 0) 121 pitch_type = aubio_pitcht_specacf; 117 122 else if (strcmp (pitch_mode, "default") == 0) 118 123 pitch_type = aubio_pitcht_default; … … 159 164 aubio_pitchyinfft_set_tolerance (p->p_object, 0.85); 160 165 break; 166 case aubio_pitcht_specacf: 167 p->buf = new_fvec (bufsize); 168 p->p_object = new_aubio_pitchspecacf (bufsize); 169 p->detect_cb = aubio_pitch_do_specacf; 170 p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchspecacf_get_tolerance; 171 aubio_pitchspecacf_set_tolerance (p->p_object, 0.85); 172 break; 161 173 default: 162 174 break; … … 190 202 del_fvec (p->buf); 191 203 del_aubio_pitchyinfft (p->p_object); 204 break; 205 case aubio_pitcht_specacf: 206 del_fvec (p->buf); 207 del_aubio_pitchspecacf (p->p_object); 192 208 break; 193 209 default: … … 316 332 317 333 void 334 aubio_pitch_do_specacf (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * out) 335 { 336 aubio_pitch_slideblock (p, ibuf); 337 aubio_pitchspecacf_do (p->p_object, p->buf, out); 338 //out->data[0] = aubio_bintofreq (out->data[0], p->samplerate, p->bufsize); 339 smpl_t pitch = 0., period = out->data[0]; 340 if (period > 0) { 341 pitch = p->samplerate / period; 342 } else { 343 pitch = 0.; 344 } 345 out->data[0] = pitch; 346 } 347 348 void 318 349 aubio_pitch_do_fcomb (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * out) 319 350 {
Note: See TracChangeset
for help on using the changeset viewer.