- Timestamp:
- Apr 10, 2013, 1:47:05 AM (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:
- e987c05
- Parents:
- 483b883
- Location:
- src/pitch
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitch/pitch.c
r483b883 r9c9202f 159 159 case aubio_pitcht_yinfft: 160 160 p->buf = new_fvec (bufsize); 161 p->p_object = new_aubio_pitchyinfft ( bufsize);161 p->p_object = new_aubio_pitchyinfft (samplerate, bufsize); 162 162 p->detect_cb = aubio_pitch_do_yinfft; 163 163 p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyinfft_get_confidence; -
src/pitch/pitchyinfft.c
r483b883 r9c9202f 38 38 smpl_t tol; /**< Yin tolerance */ 39 39 smpl_t confidence; /**< confidence */ 40 uint_t short_period; /** shortest period under which to check for octave error */ 40 41 }; 41 42 … … 53 54 54 55 aubio_pitchyinfft_t * 55 new_aubio_pitchyinfft (uint_t bufsize)56 new_aubio_pitchyinfft (uint_t samplerate, uint_t bufsize) 56 57 { 57 58 aubio_pitchyinfft_t *p = AUBIO_NEW (aubio_pitchyinfft_t); … … 67 68 smpl_t freq = 0, a0 = 0, a1 = 0, f0 = 0, f1 = 0; 68 69 for (i = 0; i < p->weight->length; i++) { 69 freq = (smpl_t) i / (smpl_t) bufsize *(smpl_t) 44100.;70 freq = (smpl_t) i / (smpl_t) bufsize *(smpl_t) samplerate; 70 71 while (freq > freqs[j]) { 71 72 j += 1; … … 90 91 //p->weight->data[i] = SQRT(DB2LIN(p->weight->data[i])); 91 92 } 93 // check for octave errors above 1300 Hz 94 p->short_period = (uint_t)ROUND(samplerate / 1300.); 92 95 return p; 93 96 } … … 143 146 //return fvec_quadratic_peak_pos (yin,tau,1); 144 147 /* additional check for (unlikely) octave doubling in higher frequencies */ 145 if (tau > 35) {148 if (tau > p->short_period) { 146 149 output->data[0] = fvec_quadratic_peak_pos (yin, tau); 147 150 } else { -
src/pitch/pitchyinfft.h
r483b883 r9c9202f 59 59 60 60 */ 61 aubio_pitchyinfft_t *new_aubio_pitchyinfft (uint_t buf_size);61 aubio_pitchyinfft_t *new_aubio_pitchyinfft (uint_t samplerate, uint_t buf_size); 62 62 /** deletion of the pitch detection object 63 63
Note: See TracChangeset
for help on using the changeset viewer.