- Timestamp:
- Mar 16, 2006, 4:42:11 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:
- 845f2d4
- Parents:
- fbd3de6
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitchdetection.c
rfbd3de6 rf8a38c5 21 21 #include "phasevoc.h" 22 22 #include "mathutils.h" 23 //#include "filter.h"23 #include "filter.h" 24 24 #include "pitchmcomb.h" 25 25 #include "pitchyin.h" … … 44 44 aubio_pitchfcomb_t * fcomb; 45 45 aubio_pitchschmitt_t * schmitt; 46 //aubio_filter_t * filter;46 aubio_filter_t * filter; 47 47 /* for yin */ 48 48 fvec_t * buf; … … 50 50 aubio_pitchdetection_func_t callback; 51 51 aubio_pitchdetection_conv_t freqconv; 52 smpl_t yinthres; 52 53 }; 53 54 … … 86 87 p->yin = new_fvec(bufsize/2,channels); 87 88 p->callback = aubio_pitchdetection_yin; 89 p->yinthres = 0.2; 88 90 break; 89 91 case aubio_pitch_mcomb: 90 92 p->pv = new_aubio_pvoc(bufsize, hopsize, channels); 91 93 p->fftgrain = new_cvec(bufsize, channels); 92 p->mcomb = new_aubio_pitchmcomb(bufsize,channels); 94 p->mcomb = new_aubio_pitchmcomb(bufsize,channels,samplerate); 95 p->filter = new_aubio_cdsgn_filter(samplerate); 93 96 p->callback = aubio_pitchdetection_mcomb; 94 97 break; 95 98 case aubio_pitch_fcomb: 96 99 p->buf = new_fvec(bufsize,channels); 97 p->fcomb = new_aubio_pitchfcomb(bufsize, samplerate);100 p->fcomb = new_aubio_pitchfcomb(bufsize,hopsize,samplerate); 98 101 p->callback = aubio_pitchdetection_fcomb; 99 102 break; … … 168 171 } 169 172 173 void aubio_pitchdetection_set_yinthresh(aubio_pitchdetection_t *p, smpl_t thres) { 174 p->yinthres = thres; 175 } 176 170 177 smpl_t aubio_pitchdetection(aubio_pitchdetection_t *p, fvec_t * ibuf) { 171 178 return p->freqconv(p->callback(p,ibuf),p->srate,p->bufsize); … … 174 181 smpl_t aubio_pitchdetection_mcomb(aubio_pitchdetection_t *p, fvec_t *ibuf) { 175 182 smpl_t pitch = 0.; 183 aubio_filter_do(p->filter,ibuf); 176 184 aubio_pvoc_do(p->pv,ibuf,p->fftgrain); 177 185 pitch = aubio_pitchmcomb_detect(p->mcomb,p->fftgrain); … … 188 196 smpl_t pitch = 0.; 189 197 aubio_pitchdetection_slideblock(p,ibuf); 190 pitch = aubio_pitchyin_getpitchfast(p->buf,p->yin, 0.5);198 pitch = aubio_pitchyin_getpitchfast(p->buf,p->yin, p->yinthres); 191 199 if (pitch>0) { 192 200 pitch = p->srate/(pitch+0.); -
src/pitchdetection.h
rfbd3de6 rf8a38c5 46 46 smpl_t aubio_pitchdetection_fcomb(aubio_pitchdetection_t *p, fvec_t *ibuf); 47 47 48 void aubio_pitchdetection_set_yinthresh(aubio_pitchdetection_t *p, smpl_t thres); 48 49 void del_aubio_pitchdetection(aubio_pitchdetection_t * p); 49 50
Note: See TracChangeset
for help on using the changeset viewer.