Changeset 4621cd6 for examples/aubionotes.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/aubionotes.c
rc17a0ee r4621cd6 19 19 */ 20 20 21 #define AUBIO_UNSTABLE 1 // for fvec_median _channel21 #define AUBIO_UNSTABLE 1 // for fvec_median 22 22 23 23 #include "utils.h" … … 50 50 51 51 static int aubio_process(smpl_t **input, smpl_t **output, int nframes) { 52 unsigned int i; /*channels*/53 52 unsigned int j; /*frames*/ 54 53 for (j=0;j<(unsigned)nframes;j++) { 55 54 if(usejack) { 56 for (i=0;i<channels;i++) { 57 /* write input to datanew */ 58 fvec_write_sample(ibuf, input[i][j], i, pos); 59 /* put synthnew in output */ 60 output[i][j] = fvec_read_sample(obuf, i, pos); 61 } 55 /* write input to datanew */ 56 fvec_write_sample(ibuf, input[0][j], pos); 57 /* put synthnew in output */ 58 output[0][j] = fvec_read_sample(obuf, pos); 62 59 } 63 60 /*time for fft*/ … … 67 64 68 65 aubio_pitch_do (pitchdet, ibuf, pitch_obuf); 69 pitch = fvec_read_sample(pitch_obuf, 0 , 0);66 pitch = fvec_read_sample(pitch_obuf, 0); 70 67 if(median){ 71 68 note_append(note_buffer, pitch); … … 74 71 /* curlevel is negatif or 1 if silence */ 75 72 curlevel = aubio_level_detection(ibuf, silence); 76 if (fvec_read_sample(onset, 0 , 0)) {73 if (fvec_read_sample(onset, 0)) { 77 74 /* test for silence */ 78 75 if (curlevel == 1.) { … … 92 89 93 90 for (pos = 0; pos < overlap_size; pos++){ 94 obuf->data[ 0][pos] = woodblock->data[0][pos];91 obuf->data[pos] = woodblock->data[pos]; 95 92 } 96 93 } … … 112 109 } // if median 113 110 for (pos = 0; pos < overlap_size; pos++) 114 obuf->data[ 0][pos] = 0.;111 obuf->data[pos] = 0.; 115 112 } 116 113 /* end of block loop */ … … 131 128 uint_t i = 0; 132 129 for (i = 0; i < note_buffer->length - 1; i++) { 133 note_buffer->data[ 0][i] = note_buffer->data[0][i + 1];130 note_buffer->data[i] = note_buffer->data[i + 1]; 134 131 } 135 note_buffer->data[ 0][note_buffer->length - 1] = curnote;132 note_buffer->data[note_buffer->length - 1] = curnote; 136 133 return; 137 134 } … … 142 139 uint_t i; 143 140 for (i = 0; i < note_buffer->length; i++) { 144 note_buffer2->data[ 0][i] = note_buffer->data[0][i];141 note_buffer2->data[i] = note_buffer->data[i]; 145 142 } 146 return fvec_median _channel (note_buffer2, 0);143 return fvec_median (note_buffer2); 147 144 } 148 145 … … 150 147 examples_common_init(argc,argv); 151 148 152 o = new_aubio_onset (onset_mode, buffer_size, overlap_size, channels, 153 samplerate); 149 o = new_aubio_onset (onset_mode, buffer_size, overlap_size, samplerate); 154 150 if (threshold != 0.) aubio_onset_set_threshold (o, threshold); 155 onset = new_fvec (1 , channels);151 onset = new_fvec (1); 156 152 157 153 pitchdet = new_aubio_pitch (pitch_mode, buffer_size * 4, 158 overlap_size, channels,samplerate);154 overlap_size, samplerate); 159 155 aubio_pitch_set_tolerance (pitchdet, 0.7); 160 pitch_obuf = new_fvec (1 , channels);156 pitch_obuf = new_fvec (1); 161 157 if (median) { 162 note_buffer = new_fvec (median , 1);163 note_buffer2 = new_fvec (median , 1);158 note_buffer = new_fvec (median); 159 note_buffer2 = new_fvec (median); 164 160 } 165 161
Note: See TracChangeset
for help on using the changeset viewer.