- Timestamp:
- Dec 31, 2013, 12:24:44 AM (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:
- 78c21cf
- Parents:
- c21acb9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mathutils.c
rc21acb9 r5644069 418 418 419 419 smpl_t fvec_quadratic_peak_pos (fvec_t * x, uint_t pos) { 420 smpl_t s0, s1, s2; 420 smpl_t s0, s1, s2; uint_t x0, x2; 421 421 if (pos == 0 || pos == x->length - 1) return pos; 422 uint_tx0 = (pos < 1) ? pos : pos - 1;423 uint_tx2 = (pos + 1 < x->length) ? pos + 1 : pos;422 x0 = (pos < 1) ? pos : pos - 1; 423 x2 = (pos + 1 < x->length) ? pos + 1 : pos; 424 424 if (x0 == pos) return (x->data[pos] <= x->data[x2]) ? pos : x2; 425 425 if (x2 == pos) return (x->data[pos] <= x->data[x0]) ? pos : x0; … … 449 449 aubio_freqtomidi (smpl_t freq) 450 450 { 451 smpl_t midi; 451 452 if (freq < 2. || freq > 100000.) return 0.; // avoid nans and infs 452 453 /* log(freq/A-2)/log(2) */ 453 smpl_tmidi = freq / 6.875;454 midi = freq / 6.875; 454 455 midi = LOG (midi) / 0.69314718055995; 455 456 midi *= 12; … … 461 462 aubio_miditofreq (smpl_t midi) 462 463 { 464 smpl_t freq; 463 465 if (midi > 140.) return 0.; // avoid infs 464 smpl_tfreq = (midi + 3.) / 12.;466 freq = (midi + 3.) / 12.; 465 467 freq = EXP (freq * 0.69314718055995); 466 468 freq *= 6.875;
Note: See TracChangeset
for help on using the changeset viewer.