- Timestamp:
- Oct 8, 2009, 8:07:20 PM (15 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:
- f162cf9
- Parents:
- 8040cca
- Location:
- src/pitch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitch/pitchmcomb.c
r8040cca re5757cf 52 52 smpl_t cutoff; /**< low-pass filter cutoff [0.34, 1] */ 53 53 smpl_t tol; /**< tolerance [0.05] */ 54 smpl_t tau; /**< frequency precision [44100/4096] */54 // smpl_t tau; /**< frequency precision [44100/4096] */ 55 55 uint_t win_post; /**< median filter window length */ 56 56 uint_t win_pre; /**< median filter window */ … … 92 92 93 93 94 smpl_t aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, cvec_t * fftgrain) {95 uint_t i =0,j;94 void aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, cvec_t * fftgrain, fvec_t * output) { 95 uint_t i,j; 96 96 smpl_t instfreq; 97 97 fvec_t * newmag = (fvec_t *)p->newmag; 98 98 //smpl_t hfc; //fe=instfreq(theta1,theta,ops); //theta1=theta; 99 99 /* copy incoming grain to newmag */ 100 for (i=0; i< fftgrain->channels; i++) { 100 101 for (j=0; j< newmag->length; j++) 101 newmag->data[ i][j]=fftgrain->norm[i][j];102 newmag->data[0][j]=fftgrain->norm[i][j]; 102 103 /* detect only if local energy > 10. */ 103 104 //if (fvec_local_energy(newmag)>10.) { … … 108 109 //return p->candidates[p->goodcandidate]->ebin; 109 110 j = (uint_t)FLOOR(p->candidates[p->goodcandidate]->ebin+.5); 110 instfreq = aubio_unwrap2pi(fftgrain->phas[ 0][j]111 - p->theta->data[ 0][j] - j*p->phasediff);111 instfreq = aubio_unwrap2pi(fftgrain->phas[i][j] 112 - p->theta->data[i][j] - j*p->phasediff); 112 113 instfreq *= p->phasefreq; 113 114 /* store phase for next run */ … … 116 117 } 117 118 //return p->candidates[p->goodcandidate]->ebin; 118 returnFLOOR(p->candidates[p->goodcandidate]->ebin+.5) + instfreq;119 output->data[i][0] = FLOOR(p->candidates[p->goodcandidate]->ebin+.5) + instfreq; 119 120 /*} else { 120 121 return -1.; 121 122 }*/ 123 } 122 124 } 123 125 … … 327 329 } 328 330 329 aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t bufsize, uint_t hopsize, uint_t channels , uint_t samplerate) {331 aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t bufsize, uint_t hopsize, uint_t channels) { 330 332 aubio_pitchmcomb_t * p = AUBIO_NEW(aubio_pitchmcomb_t); 331 333 /* bug: should check if size / 8 > post+pre+1 */ … … 339 341 p->win_post = 8; 340 342 p->win_pre = 7; 341 p->tau = samplerate/bufsize;343 // p->tau = samplerate/bufsize; 342 344 p->alpha = 9.; 343 345 p->goodcandidate = 0; … … 348 350 //p->biquad = new_biquad(0.1600,0.3200,0.1600, -0.5949, 0.2348); 349 351 /* allocate temp memory */ 350 p->newmag = new_fvec(spec_size, channels);352 p->newmag = new_fvec(spec_size,1); 351 353 /* array for median */ 352 p->scratch = new_fvec(spec_size, channels);354 p->scratch = new_fvec(spec_size,1); 353 355 /* array for phase */ 354 356 p->theta = new_fvec(spec_size,channels); 355 357 /* array for adaptative threshold */ 356 p->scratch2 = new_fvec(p->win_post+p->win_pre+1, channels);358 p->scratch2 = new_fvec(p->win_post+p->win_pre+1,1); 357 359 /* array of spectral peaks */ 358 360 p->peaks = AUBIO_ARRAY(aubio_spectralpeak_t,spec_size); -
src/pitch/pitchmcomb.h
r8040cca re5757cf 49 49 50 50 */ 51 smpl_t aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, cvec_t * fftgrain);51 void aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, cvec_t * fftgrain, fvec_t * output); 52 52 /** creation of the pitch detection object 53 53 … … 58 58 59 59 */ 60 aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t bufsize, uint_t hopsize, uint_t channels , uint_t samplerate);60 aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t bufsize, uint_t hopsize, uint_t channels); 61 61 /** deletion of the pitch detection object 62 62
Note: See TracChangeset
for help on using the changeset viewer.