Changeset 26775a3 for tests/src/onset
- Timestamp:
- Mar 3, 2013, 7:36:18 PM (12 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:
- 6938a20
- Parents:
- 248da64
- Location:
- tests/src/onset
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/src/onset/test-onset.c
r248da64 r26775a3 1 1 #include <aubio.h> 2 2 3 int main(){ 4 /* allocate some memory */ 5 uint_t win_s = 1024; /* window size */ 6 fvec_t * in = new_fvec (win_s/4); /* input buffer */ 7 fvec_t * out = new_fvec (2); /* input buffer */ 8 aubio_onset_t * onset = new_aubio_onset("complex", win_s, win_s/4, 44100.); 9 uint_t i = 0; 3 int main () 4 { 5 // 1. allocate some memory 6 uint_t n = 0; // frame counter 7 uint_t win_s = 1024; // window size 8 uint_t hop_s = win_s / 4; // hop size 9 uint_t samplerate = 44100; // samplerate 10 // create some vectors 11 fvec_t * input = new_fvec (win_s/4); // input buffer 12 fvec_t * out = new_fvec (2); // input buffer 13 // create onset object 14 aubio_onset_t * onset = new_aubio_onset("complex", win_s, hop_s, samplerate); 10 15 11 while (i < 10) { 12 aubio_onset_do (onset,in,out); 13 i++; 14 }; 16 // 2. do something with it 17 while (n < 10) { 18 // get `hop_s` new samples into `input` 19 // ... 20 // exectute onset detection 21 aubio_onset_do (onset, input, out); 22 // do something with output candidates 23 // ... 24 n++; 25 }; 15 26 16 del_aubio_onset(onset); 17 del_fvec(in); 18 del_fvec(out); 19 aubio_cleanup(); 27 // 3. clean up memory 28 del_aubio_onset(onset); 29 del_fvec(input); 30 del_fvec(out); 31 aubio_cleanup(); 20 32 21 33 return 0; 22 34 } -
tests/src/onset/test-peakpicker.c
r248da64 r26775a3 3 3 #include <aubio.h> 4 4 5 int main (){6 /* allocate some memory */ 7 uint_t win_s = 1024; /* window size */8 fvec_t * in = new_fvec (win_s); /* input buffer */9 fvec_t * out = new_fvec (1); /* input buffer */10 11 5 int main () 6 { 7 uint_t win_s = 1024; // window size 8 fvec_t * in = new_fvec (win_s); // input buffer 9 fvec_t * out = new_fvec (1); // input buffer 10 aubio_peakpicker_t * o = new_aubio_peakpicker(); 11 aubio_peakpicker_set_threshold (o, 0.3); 12 12 13 14 15 16 13 aubio_peakpicker_do(o, in, out); 14 aubio_peakpicker_do(o, in, out); 15 aubio_peakpicker_do(o, in, out); 16 aubio_peakpicker_do(o, in, out); 17 17 18 19 20 21 18 del_aubio_peakpicker(o); 19 del_fvec(out); 20 del_fvec(in); 21 return 0; 22 22 } 23 23
Note: See TracChangeset
for help on using the changeset viewer.