Changeset 56ef7e1 for src/onset/onset.c
- Timestamp:
- Oct 18, 2009, 3:08:59 PM (14 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:
- e5f49af
- Parents:
- 74516f7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/onset/onset.c
r74516f7 r56ef7e1 37 37 smpl_t silence; /**< silence threhsold */ 38 38 uint_t minioi; /**< minimum inter onset interval */ 39 uint_t wasonset;/**< number of frames since last onset */39 fvec_t * wasonset; /**< number of frames since last onset */ 40 40 uint_t samplerate; /**< sampling rate of the input signal */ 41 41 }; … … 44 44 void aubio_onset_do (aubio_onset_t *o, fvec_t * input, fvec_t * onset) 45 45 { 46 uint_t isonset = 0; 47 uint_t wasonset = o->wasonset; 46 smpl_t isonset = 0; 47 smpl_t wasonset = 0; 48 uint_t i; 48 49 aubio_pvoc_do (o->pv,input, o->fftgrain); 49 50 aubio_onsetdetection_do (o->od,o->fftgrain, o->of); … … 52 53 onset->data[0][0] *= onset2->data[0][0]; 53 54 }*/ 54 isonset = aubio_peakpicker_do(o->pp, o->of); 55 aubio_peakpicker_do(o->pp, o->of, onset); 56 for (i = 0; i < input->channels; i++) { 57 isonset = onset->data[i][0]; 58 wasonset = o->wasonset->data[i][0]; 55 59 if (isonset > 0.) { 56 60 if (aubio_silence_detection(input, o->silence)==1) { … … 68 72 wasonset++; 69 73 } 70 o->wasonset = wasonset; 71 onset->data[0][0] = isonset; 74 o->wasonset->data[i][0] = wasonset; 75 onset->data[i][0] = isonset; 76 } 72 77 return; 73 78 } … … 98 103 o->minioi = 4; 99 104 o->silence = -70; 100 o->wasonset = 0;105 o->wasonset = new_fvec(1, channels); 101 106 o->samplerate = samplerate; 102 107 o->pv = new_aubio_pvoc(buf_size, hop_size, channels); 103 o->pp = new_aubio_peakpicker(o->threshold); 108 o->pp = new_aubio_peakpicker(channels); 109 aubio_peakpicker_set_threshold (o->pp, o->threshold); 104 110 o->od = new_aubio_onsetdetection(onset_mode,buf_size,channels); 105 111 o->fftgrain = new_cvec(buf_size,channels); … … 118 124 del_aubio_pvoc(o->pv); 119 125 del_fvec(o->of); 126 del_fvec(o->wasonset); 120 127 del_cvec(o->fftgrain); 121 128 AUBIO_FREE(o);
Note: See TracChangeset
for help on using the changeset viewer.