Changeset 09558b8
- Timestamp:
- Feb 2, 2017, 2:04:27 AM (8 years ago)
- Branches:
- yinfft+
- Children:
- 422a2a9
- Parents:
- a7b14a6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitch/pitchyinfft.c
ra7b14a6 r09558b8 112 112 uint_t tau, l; 113 113 uint_t length = p->fftout->length; 114 uint_t halfperiod;115 114 fvec_t *fftout = p->fftout; 116 115 fvec_t *yin = p->yinfft; 117 116 smpl_t tmp = 0., sum = 0.; 117 uint_t startbin = 0, endbin = 0, before = 0, after = 0; 118 118 119 119 // window the input … … 154 154 tmp = fvec_min(yin); 155 155 if (tmp > p->tol) { 156 // give up - got no confident candidate at all 156 // give up - got no confident candidate at all 157 157 output->data[0] = 0.; 158 158 return; … … 169 169 } 170 170 // find local min around current pick to sharpen the results 171 const uint_t LOCAL_NOTE_SEEK_RANGE = 1; 172 const smpl_t note = aubio_bintomidi (tau, p->samplerate, p->fftout->length); 173 const uint_t startbin = MAX (0, (uint_t)aubio_miditobin (note - LOCAL_NOTE_SEEK_RANGE, 174 p->samplerate, p->fftout->length)); 175 const uint_t endbin = MIN (yin->length, (uint_t)(aubio_miditobin (note + LOCAL_NOTE_SEEK_RANGE, 176 p->samplerate, p->fftout->length) + 0.5)); 171 before = 2, after = 5; 172 // for low frequency, the peak may be large, we use a larger after 173 if (tau > yin->length/2) { before = 1; after = 20; } 174 startbin = tau > before ? tau - before : 0; 175 endbin = tau < yin->length - 1 - after ? tau + after : yin->length - 1; 177 176 tmp = yin->data[tau]; 178 177 for (l = startbin; l < endbin; l++) {
Note: See TracChangeset
for help on using the changeset viewer.