Changeset 4621cd6 for examples/aubioonset.c
- Timestamp:
- Dec 4, 2009, 1:46:40 AM (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:
- aea235c
- Parents:
- c17a0ee
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/aubioonset.c
rc17a0ee r4621cd6 31 31 for (j=0;j<(unsigned)nframes;j++) { 32 32 if(usejack) { 33 for (i=0;i<channels;i++) { 34 /* write input to datanew */ 35 fvec_write_sample(ibuf, input[i][j], i, pos); 36 /* put synthnew in output */ 37 output[i][j] = fvec_read_sample(obuf, i, pos); 38 } 33 /* write input to datanew */ 34 fvec_write_sample(ibuf, input[0][j], pos); 35 /* put synthnew in output */ 36 output[0][j] = fvec_read_sample(obuf, pos); 39 37 } 40 38 /*time for fft*/ 41 if (pos == overlap_size-1) { 39 if (pos == overlap_size-1) { 42 40 /* block loop */ 43 41 aubio_onset_do (o, ibuf, onset); 44 if ( fvec_read_sample(onset, 0, 0)) {42 if ( fvec_read_sample(onset, 0) ) { 45 43 fvec_copy (woodblock, obuf); 46 44 } else { … … 55 53 } 56 54 57 static void process_print (void) { 58 /* output times in seconds, taking back some 59 * delay to ensure the label is _before_ the 60 * actual onset */ 61 if (!verbose && usejack) return; 62 smpl_t onset_found = fvec_read_sample(onset, 0, 0); 63 if (onset_found) { 64 if(frames >= 4) { 65 outmsg("%f\n",(frames - frames_delay + onset_found) 66 *overlap_size/(float)samplerate); 67 } else if (frames < frames_delay) { 68 outmsg("%f\n",0.); 69 } 70 } 55 static void 56 process_print (void) 57 { 58 /* output times in seconds, taking back some delay to ensure the label is 59 * _before_ the actual onset */ 60 if (!verbose && usejack) 61 return; 62 smpl_t onset_found = fvec_read_sample (onset, 0); 63 if (onset_found) { 64 if (frames >= 4) { 65 outmsg ("%f\n", (frames - frames_delay + onset_found) 66 * overlap_size / (float) samplerate); 67 } else if (frames < frames_delay) { 68 outmsg ("%f\n", 0.); 69 } 70 } 71 71 } 72 72 … … 75 75 examples_common_init(argc,argv); 76 76 77 o = new_aubio_onset (onset_mode, buffer_size, overlap_size, channels, 78 samplerate); 77 o = new_aubio_onset (onset_mode, buffer_size, overlap_size, samplerate); 79 78 if (threshold != 0.) aubio_onset_set_threshold (o, threshold); 80 onset = new_fvec (1 , channels);79 onset = new_fvec (1); 81 80 82 81 examples_common_process(aubio_process,process_print);
Note: See TracChangeset
for help on using the changeset viewer.