Changeset ef1c3b7
- Timestamp:
- Sep 11, 2007, 12:14:01 AM (17 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:
- f72ceeb
- Parents:
- 7212394 (diff), 7a46bf6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 9 added
- 1 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/Makefile.am
r7212394 ref1c3b7 11 11 aubioonset \ 12 12 aubiotrack \ 13 aubionotes 13 aubionotes \ 14 aubiomfcc 14 15 15 16 noinst_PROGRAMS = \ … … 23 24 aubiotrack_SOURCES = aubiotrack.c utils.c 24 25 aubioquiet_SOURCES = aubioquiet.c utils.c 26 aubiomfcc_SOURCES = aubiomfcc.c utils.c 25 27 26 28 aubioonset_LDADD = @JACK_LIBS@ … … 28 30 aubiotrack_LDADD = @JACK_LIBS@ 29 31 aubioquiet_LDADD = @JACK_LIBS@ 32 aubiomfcc_LDADD = @JACK_LIBS@ -
examples/tests/test-beattracking.c
r7212394 ref1c3b7 13 13 uint_t i = 0; 14 14 15 smpl_t curtempo; 16 15 17 while (i < 10) { 16 18 aubio_beattracking_do(tempo,in,out); 19 curtempo = aubio_beattracking_get_bpm(tempo); 20 if (curtempo != 0.) { 21 fprintf(stdout,"%f\n",curtempo); 22 return 1; 23 } 17 24 i++; 18 25 }; -
examples/tests/test-tempo.c
r7212394 ref1c3b7 10 10 uint_t i = 0; 11 11 12 smpl_t curtempo; 13 12 14 while (i < 1000) { 13 15 aubio_tempo(o,in,out); 16 curtempo = aubio_tempo_get_bpm(o); 17 if (curtempo != 0.) { 18 fprintf(stdout,"%f\n",curtempo); 19 } 14 20 i++; 15 21 }; -
examples/utils.c
r7212394 ref1c3b7 60 60 int isonset = 0; 61 61 aubio_pickpeak_t * parms; 62 63 62 64 63 /* pitch objects */ … … 301 300 fftgrain = new_cvec(buffer_size, channels); 302 301 302 303 303 if (usepitch) { 304 304 pitchdet = new_aubio_pitchdetection(buffer_size*4, … … 313 313 /* phase vocoder */ 314 314 pv = new_aubio_pvoc(buffer_size, overlap_size, channels); 315 315 316 /* onsets */ 316 317 parms = new_aubio_peakpicker(threshold); … … 346 347 del_fvec(onset); 347 348 del_fvec(woodblock); 349 348 350 aubio_cleanup(); 349 351 } -
examples/utils.h
r7212394 ref1c3b7 98 98 extern aubio_pickpeak_t * parms; 99 99 100 101 100 /* pitch objects */ 102 101 extern smpl_t pitch; -
python/aubio/aubioclass.py
r7212394 ref1c3b7 127 127 self.pitchp = new_aubio_pitchdetection(bufsize,hopsize,channels, 128 128 samplerate,mode,omode) 129 129 aubio_pitchdetection_set_yinthresh(self.pitchp,yinthresh) 130 130 #self.filt = filter(srate,"adsgn") 131 131 def __del__(self): -
src/Makefile.am
r7212394 ref1c3b7 22 22 onset.h \ 23 23 tempo.h \ 24 filter.h 24 filter.h \ 25 filterbank.h \ 26 mfcc.h 27 25 28 nodist_pkginclude_HEADERS = config.h 26 29 … … 69 72 tempo.h \ 70 73 filter.c \ 71 filter.h 74 filter.h \ 75 filterbank.c \ 76 filterbank.h \ 77 mfcc.h \ 78 mfcc.c 72 79 73 80 AM_CFLAGS = @AUBIO_CFLAGS@ @FFTWLIB_CFLAGS@ @SAMPLERATE_CFLAGS@ -
src/aubio.h
r7212394 ref1c3b7 80 80 #include "onset.h" 81 81 #include "tempo.h" 82 #include "filterbank.h" 83 #include "mfcc.h" 82 84 83 85 #ifdef __cplusplus -
src/beattracking.c
r7212394 ref1c3b7 453 453 454 454 } 455 456 smpl_t aubio_beattracking_get_bpm(aubio_beattracking_t * bt) { 457 if (bt->timesig != 0 && bt->counter == 0 && bt->flagstep == 0) { 458 return 5168. / (smpl_t)bt->gp; 459 } else { 460 return 0.; 461 } 462 } -
src/beattracking.h
r7212394 ref1c3b7 60 60 */ 61 61 void aubio_beattracking_do(aubio_beattracking_t * bt, fvec_t * dfframes, fvec_t * out); 62 /** get current tempo in bpm 63 64 \param bt beat tracking object 65 66 Returns the currently observed tempo, in beats per minutes, or 0 if no 67 consistent value is found. 68 69 */ 70 smpl_t aubio_beattracking_get_bpm(aubio_beattracking_t * bt); 62 71 /** delete beat tracking object 63 72 -
src/mathutils.c
r7212394 ref1c3b7 30 30 case aubio_win_rectangle: 31 31 for (i=0;i<size;i++) 32 w[i] = 0.5; 32 w[i] = 0.5; 33 33 break; 34 34 case aubio_win_hamming: … … 48 48 w[i] = 0.42 49 49 - 0.50 * COS( TWO_PI*i/(size-1.0)) 50 + 50 + 0.08 * COS(2.0*TWO_PI*i/(size-1.0)); 51 51 break; 52 52 case aubio_win_blackman_harris: 53 53 for (i=0;i<size;i++) 54 w[i] = 0.35875 54 w[i] = 0.35875 55 55 - 0.48829 * COS( TWO_PI*i/(size-1.0)) 56 56 + 0.14128 * COS(2.0*TWO_PI*i/(size-1.0)) … … 74 74 } 75 75 76 77 76 smpl_t aubio_unwrap2pi(smpl_t phase) { 78 77 /* mod(phase+pi,-2pi)+pi */ … … 80 79 } 81 80 82 83 smpl_t vec_mean(fvec_t *s) 84 { 81 smpl_t vec_mean(fvec_t *s) { 85 82 uint_t i,j; 86 83 smpl_t tmp = 0.0f; … … 91 88 } 92 89 93 94 smpl_t vec_sum(fvec_t *s) 95 { 90 smpl_t vec_sum(fvec_t *s) { 96 91 uint_t i,j; 97 92 smpl_t tmp = 0.0f; … … 102 97 } 103 98 104 105 smpl_t vec_max(fvec_t *s) 106 { 99 smpl_t vec_max(fvec_t *s) { 107 100 uint_t i,j; 108 101 smpl_t tmp = 0.0f; … … 113 106 } 114 107 115 smpl_t vec_min(fvec_t *s) 116 { 108 smpl_t vec_min(fvec_t *s) { 117 109 uint_t i,j; 118 110 smpl_t tmp = s->data[0][0]; … … 123 115 } 124 116 125 126 uint_t vec_min_elem(fvec_t *s) 127 { 117 uint_t vec_min_elem(fvec_t *s) { 128 118 uint_t i,j=0, pos=0.; 129 119 smpl_t tmp = s->data[0][0]; … … 136 126 } 137 127 138 uint_t vec_max_elem(fvec_t *s) 139 { 128 uint_t vec_max_elem(fvec_t *s) { 140 129 uint_t i,j=0, pos=0.; 141 130 smpl_t tmp = 0.0f; … … 148 137 } 149 138 150 void vec_shift(fvec_t *s) 151 { 139 void vec_shift(fvec_t *s) { 152 140 uint_t i,j; 153 141 //smpl_t tmp = 0.0f; … … 161 149 } 162 150 163 smpl_t vec_local_energy(fvec_t * f) 164 { 151 smpl_t vec_local_energy(fvec_t * f) { 165 152 smpl_t locE = 0.; 166 153 uint_t i,j; … … 171 158 } 172 159 173 smpl_t vec_local_hfc(fvec_t * f) 174 { 160 smpl_t vec_local_hfc(fvec_t * f) { 175 161 smpl_t locE = 0.; 176 162 uint_t i,j; … … 181 167 } 182 168 183 smpl_t vec_alpha_norm(fvec_t * DF, smpl_t alpha) 184 { 169 smpl_t vec_alpha_norm(fvec_t * DF, smpl_t alpha) { 185 170 smpl_t tmp = 0.; 186 171 uint_t i,j; … … 191 176 } 192 177 193 194 void vec_dc_removal(fvec_t * mag) 195 { 178 void vec_dc_removal(fvec_t * mag) { 196 179 smpl_t mini = 0.; 197 180 uint_t length = mag->length, i=0, j; … … 202 185 } 203 186 204 205 void vec_alpha_normalise(fvec_t * mag, uint_t alpha) 206 { 187 void vec_alpha_normalise(fvec_t * mag, uint_t alpha) { 207 188 smpl_t alphan = 1.; 208 189 uint_t length = mag->length, i=0, j; … … 213 194 } 214 195 215 216 196 void vec_add(fvec_t * mag, smpl_t threshold) { 217 197 uint_t length = mag->length, i=0, j; … … 221 201 } 222 202 223 224 void vec_adapt_thres(fvec_t * vec, fvec_t * tmp, 225 uint_t post, uint_t pre) 226 { 203 void vec_adapt_thres(fvec_t * vec, fvec_t * tmp, 204 uint_t post, uint_t pre) { 227 205 uint_t length = vec->length, i=0, j; 228 206 for (j=0;j<length;j++) { … … 232 210 233 211 smpl_t vec_moving_thres(fvec_t * vec, fvec_t * tmpvec, 234 uint_t post, uint_t pre, uint_t pos) 235 { 212 uint_t post, uint_t pre, uint_t pos) { 236 213 smpl_t * medar = (smpl_t *)tmpvec->data[0]; 237 214 uint_t k; … … 240 217 /* post part of the buffer does not exist */ 241 218 if (pos<post+1) { 242 for (k=0;k<post+1-pos;k++) 219 for (k=0;k<post+1-pos;k++) 243 220 medar[k] = 0.; /* 0-padding at the beginning */ 244 221 for (k=post+1-pos;k<win_length;k++) … … 252 229 for (k=0;k<length-pos+post+1;k++) 253 230 medar[k] = vec->data[0][k+pos-post]; 254 for (k=length-pos+post+1;k<win_length;k++) 231 for (k=length-pos+post+1;k<win_length;k++) 255 232 medar[k] = 0.; /* 0-padding at the end */ 256 } 233 } 257 234 return vec_median(tmpvec); 258 235 } … … 321 298 for (frac = 0.; frac < 2.; frac = frac + step) { 322 299 res = aubio_quadfrac(s0, s1, s2, frac); 323 if (res > resold) 300 if (res > resold) 324 301 resold = res; 325 else { 302 else { 326 303 exactpos += (frac-step)*2. - 1.; 327 304 break; … … 345 322 if (res < resold) { 346 323 resold = res; 347 } else { 324 } else { 348 325 exactpos += (frac-step)*span - span/2.; 349 326 break; … … 360 337 361 338 uint_t vec_peakpick(fvec_t * onset, uint_t pos) { 362 363 364 365 366 &&onset->data[i][pos] > 0.);367 339 uint_t i=0, tmp=0; 340 /*for (i=0;i<onset->channels;i++)*/ 341 tmp = (onset->data[i][pos] > onset->data[i][pos-1] 342 && onset->data[i][pos] > onset->data[i][pos+1] 343 && onset->data[i][pos] > 0.); 344 return tmp; 368 345 } 369 346 370 347 smpl_t aubio_freqtomidi(smpl_t freq) { 371 372 373 374 375 midi -= 3;376 348 /* log(freq/A-2)/log(2) */ 349 smpl_t midi = freq/6.875; 350 midi = LOG(midi)/0.69314718055995; 351 midi *= 12; 352 midi -= 3; 353 return midi; 377 354 } 378 355 379 356 smpl_t aubio_miditofreq(smpl_t midi) { 380 381 382 383 357 smpl_t freq = (midi+3.)/12.; 358 freq = EXP(freq*0.69314718055995); 359 freq *= 6.875; 360 return freq; 384 361 } 385 362 … … 404 381 } 405 382 406 407 408 /** returns 1 if wassilence is 0 and RMS(ibuf)<threshold 383 /** returns 1 if wassilence is 0 and RMS(ibuf)<threshold 409 384 * \bug mono 410 385 */ … … 436 411 437 412 if (loudness < threshold) 438 413 return 1.; 439 414 else 440 415 return loudness; 441 416 } 442 417 … … 451 426 } 452 427 //previous was positive 453 } else if ( input->data[i][j] <= 0. ) {428 } else if ( input->data[i][j] <= 0. ) { 454 429 zcr += 1; 455 430 } … … 471 446 } 472 447 473 void aubio_autocorr(fvec_t * input, fvec_t * output){ 474 uint_t i = 0, j = 0, length = input->length; 475 smpl_t * data = input->data[0]; 476 smpl_t * acf = output->data[0]; 477 smpl_t tmp =0.; 478 for(i=0;i<length;i++){ 479 for(j=i;j<length;j++){ 480 tmp += data[j-i]*data[j]; 481 } 482 acf[i] = tmp /(smpl_t)(length-i); 483 tmp = 0.0; 484 } 485 } 486 487 void aubio_cleanup(void) 488 { 448 void aubio_autocorr(fvec_t * input, fvec_t * output) { 449 uint_t i = 0, j = 0, length = input->length; 450 smpl_t * data = input->data[0]; 451 smpl_t * acf = output->data[0]; 452 smpl_t tmp =0.; 453 for(i=0;i<length;i++){ 454 for(j=i;j<length;j++){ 455 tmp += data[j-i]*data[j]; 456 } 457 acf[i] = tmp /(smpl_t)(length-i); 458 tmp = 0.0; 459 } 460 } 461 462 void aubio_cleanup(void) { 489 463 #if FFTW3_SUPPORT 490 464 fftw_cleanup(); 491 465 #else 492 466 #if FFTW3F_SUPPORT 493 467 fftwf_cleanup(); 494 468 #endif 495 469 #endif -
src/tempo.c
r7212394 ref1c3b7 124 124 } 125 125 126 smpl_t aubio_tempo_get_bpm(aubio_tempo_t *o) { 127 return aubio_beattracking_get_bpm(o->bt); 128 } 129 126 130 void del_aubio_tempo (aubio_tempo_t *o) 127 131 { -
src/tempo.h
r7212394 ref1c3b7 50 50 void aubio_tempo_set_threshold(aubio_tempo_t * o, smpl_t threshold); 51 51 52 /** get current tempo 53 54 \param bt beat tracking object 55 56 Returns the currently observed tempo, or 0 if no consistent value is found 57 58 */ 59 smpl_t aubio_tempo_get_bpm(aubio_tempo_t * bt); 60 52 61 /** delete tempo detection object */ 53 62 void del_aubio_tempo(aubio_tempo_t * o);
Note: See TracChangeset
for help on using the changeset viewer.