Changeset cf7c76a
- Timestamp:
- Apr 11, 2005, 6:31:48 PM (20 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:
- 84941cb
- Parents:
- a0fd4e4
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitchdetection.c
ra0fd4e4 rcf7c76a 104 104 } 105 105 } 106 /* get the autocorr and pitch */ 107 aubio_pitchyin_diff(p->buf,p->yin); 108 aubio_pitchyin_getcum(p->yin); 109 pitch = aubio_pitchyin_getpitch(p->yin); 106 pitch = aubio_pitchyin_getpitchfast(p->buf,p->yin, 0.5); 110 107 if (pitch>0) { 111 108 pitch = p->srate/(pitch+0.); … … 113 110 pitch = 0.; 114 111 } 115 //fprintf(stderr,"%f\n",pitch);116 112 break; 117 113 case mcomb: -
src/pitchyin.c
ra0fd4e4 rcf7c76a 83 83 tau++; 84 84 } while (tau<yin->length); 85 //AUBIO_DBG("No pitch found");85 AUBIO_DBG("No pitch found"); 86 86 return 0; 87 87 } … … 89 89 90 90 /* all the above in one */ 91 uint_t aubio_pitchyin_getpitchfast(fvec_t * input, fvec_t * yin ){92 uint_t c ,j,tau = 0;91 uint_t aubio_pitchyin_getpitchfast(fvec_t * input, fvec_t * yin, smpl_t tol){ 92 uint_t c=0,j,tau = 0; 93 93 smpl_t tmp = 0, tmp2; 94 for ( c=0;c<input->channels;c++)94 for (tau=0;tau<yin->length;tau++) 95 95 { 96 for (tau=0;tau<yin->length;tau++) 96 yin->data[c][tau] = 0.; 97 } 98 for (tau=1;tau<yin->length;tau++) 99 { 100 for (j=0;j<yin->length;j++) 97 101 { 98 yin->data[c][tau] = 0.; 99 } 100 for (tau=1;tau<yin->length;tau++) 101 { 102 for (j=0;j<yin->length;j++) 103 { 104 tmp = input->data[c][j] - input->data[c][j+tau]; 105 yin->data[c][tau] += SQR(tmp); 106 } 107 } 108 tmp2 = 0.; 109 yin->data[c][0] = 1.; 110 for (tau=1;tau<yin->length;tau++) 111 { 112 tmp += yin->data[c][tau]; 113 yin->data[c][tau] *= tau/tmp; 102 tmp = input->data[c][j] - input->data[c][j+tau]; 103 yin->data[c][tau] += SQR(tmp); 114 104 } 115 105 } 106 tmp2 = 0.; 107 yin->data[c][0] = 1.; 108 for (tau=1;tau<yin->length;tau++) 109 { 110 tmp += yin->data[c][tau]; 111 yin->data[c][tau] *= tau/tmp; 112 } 116 113 /* should merge the following with above */ 114 tau = 1; 117 115 do 118 116 { 119 if(yin->data[c][tau] < 0.1) {117 if(yin->data[c][tau] < tol) { 120 118 while (yin->data[c][tau+1] < yin->data[c][tau]) { 121 119 tau++; -
src/pitchyin.h
ra0fd4e4 rcf7c76a 39 39 uint_t aubio_pitchyin_getpitch(fvec_t *yinbuf); 40 40 41 uint_t aubio_pitchyin_getpitchfast(fvec_t * input, fvec_t *yinbuf );41 uint_t aubio_pitchyin_getpitchfast(fvec_t * input, fvec_t *yinbuf, smpl_t tol); 42 42 43 43 #ifdef __cplusplus
Note: See TracChangeset
for help on using the changeset viewer.