Changeset acd97d1
- Timestamp:
- Oct 15, 2013, 10:57:38 PM (11 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:
- 735a739
- Parents:
- 69c39ca
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mathutils.c
r69c39ca racd97d1 368 368 } 369 369 370 smpl_t fvec_quadint (fvec_t * x, uint_t pos) {371 smpl_t s0, s1, s2;372 uint_t x0 = (pos < 1) ? pos : pos - 1;373 uint_t x2 = (pos + 1 < x->length) ? pos + 1 : pos;374 if (x0 == pos) return (x->data[pos] <= x->data[x2]) ? pos : x2;375 if (x2 == pos) return (x->data[pos] <= x->data[x0]) ? pos : x0;376 s0 = x->data[x0];377 s1 = x->data[pos];378 s2 = x->data[x2];379 return pos + 0.5 * (s2 - s0 ) / (s2 - 2.* s1 + s0);380 }381 382 370 smpl_t fvec_quadratic_peak_pos (fvec_t * x, uint_t pos) { 383 371 smpl_t s0, s1, s2; 372 if (pos == 0 || pos == x->length - 1) return pos; 384 373 uint_t x0 = (pos < 1) ? pos : pos - 1; 385 374 uint_t x2 = (pos + 1 < x->length) ? pos + 1 : pos; -
src/mathutils.h
r69c39ca racd97d1 232 232 smpl_t fvec_median (fvec_t * v); 233 233 234 /** finds exact peak index by quadratic interpolation*/235 smpl_t fvec_quadint (fvec_t * x, uint_t pos);236 237 234 /** finds exact peak index by quadratic interpolation 238 235 -
src/onset/peakpicker.c
r69c39ca racd97d1 125 125 out->data[0] = (p->pickerfn) (onset_peek, 1); 126 126 if (out->data[0]) { 127 out->data[0] = fvec_quad int(onset_peek, 1);127 out->data[0] = fvec_quadratic_peak_pos (onset_peek, 1); 128 128 } 129 129 } -
src/tempo/beattracking.c
r69c39ca racd97d1 171 171 /* find non-zero Rayleigh period */ 172 172 maxindex = fvec_max_elem (bt->acfout); 173 bt->rp = maxindex ? fvec_quad int(bt->acfout, maxindex) : 1;173 bt->rp = maxindex ? fvec_quadratic_peak_pos (bt->acfout, maxindex) : 1; 174 174 //rp = (maxindex==127) ? 43 : maxindex; //rayparam 175 175 bt->rp = (maxindex == bt->acfout->length - 1) ? bt->rayparam : maxindex; //rayparam … … 204 204 phase = step - bt->lastbeat; 205 205 } else { 206 phase = fvec_quad int(bt->phout, maxindex);206 phase = fvec_quadratic_peak_pos (bt->phout, maxindex); 207 207 } 208 208 /* take back one frame delay */ … … 306 306 } 307 307 fvec_weight (acfout, bt->gwv); 308 gp = fvec_quad int(acfout, fvec_max_elem (acfout));308 gp = fvec_quadratic_peak_pos (acfout, fvec_max_elem (acfout)); 309 309 /* 310 310 while(gp<32) gp =gp*2; … … 409 409 aubio_beattracking_get_bpm (aubio_beattracking_t * bt) 410 410 { 411 if (bt-> timesig != 0 && bt->counter == 0 && bt->flagstep == 0) {412 return 5168. / fvec_quad int(bt->acfout, bt->bp);411 if (bt->bp != 0 && bt->timesig != 0 && bt->counter == 0 && bt->flagstep == 0) { 412 return 5168. / fvec_quadratic_peak_pos (bt->acfout, bt->bp); 413 413 } else { 414 414 return 0.;
Note: See TracChangeset
for help on using the changeset viewer.