Changeset d8604ac
- Timestamp:
- Mar 16, 2006, 4:35:51 PM (19 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:
- 8595fe3
- Parents:
- 5d1c070
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitchmcomb.c
r5d1c070 rd8604ac 94 94 newmag->data[i][j]=fftgrain->norm[i][j]; 95 95 /* detect only if local energy > 10. */ 96 if (vec_local_energy(newmag)>10.) {96 //if (vec_local_energy(newmag)>10.) { 97 97 //hfc = vec_local_hfc(newmag); //not used 98 98 aubio_pitchmcomb_spectral_pp(p, newmag); 99 99 aubio_pitchmcomb_combdet(p,newmag); 100 //aubio_pitchmcomb_sort_cand_freq(p->candidates,p->ncand); 100 101 // print picked candidate 101 102 //AUBIO_DBG("%f\n",p->candidates[p->goodcandidate]->ebin); 102 103 //AUBIO_DBG("%f\n",p->candidates[p->goodcandidate]->ebin); 103 104 return p->candidates[p->goodcandidate]->ebin; 104 } else {105 /*} else { 105 106 return -1.; 106 } 107 }*/ 107 108 } 108 109 … … 139 140 void aubio_pitchmcomb_spectral_pp(aubio_pitchmcomb_t * p, fvec_t * newmag) { 140 141 fvec_t * mag = (fvec_t *)p->scratch; 141 //fvec_t * tmp = (fvec_t *)p->scratch2;142 fvec_t * tmp = (fvec_t *)p->scratch2; 142 143 uint_t i=0,j; 143 144 uint_t length = mag->length; … … 150 151 /* skipped */ /* low pass filtering */ 151 152 /** \bug: vec_movind_thres writes out of bounds */ 152 //vec_adapt_thres(mag,tmp,p->win_post,p->win_pre); /* adaptative threshold */153 vec_adapt_thres(mag,tmp,p->win_post,p->win_pre); /* adaptative threshold */ 153 154 vec_add(mag,-p->threshold); /* fixed threshold */ 154 155 { … … 192 193 /* get the biggest peak in the spectrum */ 193 194 root_peak = aubio_pitchmcomb_get_root_peak(peaks,count); 195 if (peaks[root_peak].ebin > aubio_miditofreq(80.)/p->tau) N = 3; 196 if (peaks[root_peak].ebin > aubio_miditofreq(85.)/p->tau) N = 2; 197 if (peaks[root_peak].ebin > aubio_miditofreq(90.)/p->tau) N = 1; 194 198 /* now calculate the energy of each of the 5 combs */ 195 199 for (l=0;l<M;l++) { … … 208 212 /* for each in candidate[l]->ecomb[k] */ 209 213 for (k=0;k<curlen;k++) { 210 xx = 10000 .;214 xx = 100000.; 211 215 /** get the candidate->ecomb the closer to peaks.ebin 212 216 * (to cope with the inharmonicity)*/ … … 255 259 count += ispeak; 256 260 spectral_peaks[count-1].bin = j; 257 spectral_peaks[count-1].ebin = vec_quadint(X,j) ;261 spectral_peaks[count-1].ebin = vec_quadint(X,j) - 1.; 258 262 } 259 263 } … … 307 311 } 308 312 309 aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t size, uint_t channels ) {313 aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t size, uint_t channels, uint_t samplerate) { 310 314 aubio_pitchmcomb_t * p = AUBIO_NEW(aubio_pitchmcomb_t); 311 315 /** \bug should check if size / 8 > post+pre+1 */ 312 316 uint_t i; 313 317 uint_t spec_size; 314 p->spec_partition = 2;318 p->spec_partition = 4; 315 319 p->ncand = 5; 316 p->npartials = 10;320 p->npartials = 5; 317 321 p->cutoff = 1.; 318 322 p->threshold = 0.01; 319 323 p->win_post = 8; 320 324 p->win_pre = 7; 321 p->tau = 44100./size;325 p->tau = samplerate/size; 322 326 p->alpha = 9.; 323 327 p->goodcandidate = 0; -
src/pitchmcomb.h
r5d1c070 rd8604ac 35 35 smpl_t aubio_pitchmcomb_detect(aubio_pitchmcomb_t * p, cvec_t * fftgrain); 36 36 uint_t aubio_pitch_cands(aubio_pitchmcomb_t * p, cvec_t * fftgrain, smpl_t * cands); 37 aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t size, uint_t channels );37 aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t size, uint_t channels, uint_t samplerate); 38 38 void del_aubio_pitchmcomb(aubio_pitchmcomb_t *p); 39 39
Note: See TracChangeset
for help on using the changeset viewer.