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