Changeset cf83555
- Timestamp:
- Nov 6, 2005, 1:10:41 PM (19 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:
- 091b171
- Parents:
- f41f5c4
- Location:
- plugins/puredata
- Files:
-
- 7 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/puredata/Makefile.am
rf41f5c4 rcf83555 12 12 13 13 # Automake won't accept something ending in ".pd_linux" as a library 14 pdinstall_PROGRAMS = aubio onset~.pd_linux14 pdinstall_PROGRAMS = aubio.pd_linux 15 15 16 aubioonset__pd_linux_SOURCES = \ 17 aubioonset~.c 16 aubio_pd_linux_SOURCES = \ 17 aubio_setup.c \ 18 aubioonset~.c \ 19 aubiotempo~.c \ 20 aubiotss~.c \ 21 aubioquiet~.c 18 22 19 23 pdincludedir = $(pddir)/src -
plugins/puredata/aubioonset~.c
rf41f5c4 rcf83555 21 21 t_object x_obj; 22 22 t_float threshold; 23 t_float threshold2; 24 t_int pos; /*frames%dspblocksize*/ 23 25 t_int bufsize; 24 26 t_int hopsize; 25 27 aubio_onsetdetection_t *o; 26 28 aubio_pvoc_t * pv; 29 aubio_pickpeak_t * parms; 27 30 fvec_t *vec; 28 31 fvec_t *onset; 29 32 cvec_t *fftgrain; 30 t_outlet *onset val;33 t_outlet *onsetbang; 31 34 } t_aubioonset_tilde; 32 35 … … 36 39 t_sample *in = (t_sample *)(w[2]); 37 40 int n = (int)(w[3]); 38 //t_sample f = (x->threshold < 0.) ? 0.2 : 39 // (x->threshold > 10.) ? 10. : x->threshold; 40 while (n--) //*(x->vec->data[0])++ = (*in++); 41 x->vec->data[0][n] = in[n]; 42 aubio_pvoc_do (x->pv, x->vec, x->fftgrain); 43 aubio_onsetdetection(x->o, x->fftgrain, x->onset); 44 outlet_float(x->onsetval, x->onset->data[0][0]); 41 int j,isonset; 42 for (j=0;j<n;j++) { 43 /* write input to datanew */ 44 fvec_write_sample(x->vec, in[j], 0, x->pos); 45 /*time for fft*/ 46 if (x->pos == x->hopsize-1) { 47 /* block loop */ 48 aubio_pvoc_do (x->pv,x->vec, x->fftgrain); 49 aubio_onsetdetection(x->o,x->fftgrain, x->onset); 50 isonset = aubio_peakpick_pimrt(x->onset,x->parms); 51 if (isonset) { 52 /* test for silence */ 53 if (aubio_silence_detection(x->vec, x->threshold2)==1) 54 isonset=0; 55 else 56 outlet_bang(x->onsetbang); 57 } 58 /* end of block loop */ 59 x->pos = -1; /* so it will be zero next j loop */ 60 } 61 x->pos++; 62 } 45 63 return (w+4); 46 64 } … … 58 76 post("aubioonset~ audio in:\t%f", x->vec->data[0][0]); 59 77 post("aubioonset~ onset:\t%f", x->onset->data[0][0]); 60 outlet_float(x->onsetval, x->threshold);61 78 } 62 79 … … 67 84 68 85 x->threshold = (f < 1e-5) ? 0.1 : (f > 10.) ? 10. : f; 69 /* should get from block~ size */86 x->threshold2 = -70.; 70 87 x->bufsize = 1024; 71 88 x->hopsize = x->bufsize / 2; … … 73 90 x->o = new_aubio_onsetdetection(aubio_onset_complex, x->bufsize, 1); 74 91 x->vec = (fvec_t *)new_fvec(x->hopsize,1); 75 x->pv = new_aubio_pvoc(x->bufsize, x->hopsize, 1);76 x->fftgrain = new_cvec(x->bufsize,1);92 x->pv = (aubio_pvoc_t *)new_aubio_pvoc(x->bufsize, x->hopsize, 1); 93 x->fftgrain = (cvec_t *)new_cvec(x->bufsize,1); 77 94 x->onset = (fvec_t *)new_fvec(1,1); 95 x->parms = new_aubio_peakpicker(x->threshold); 78 96 79 97 floatinlet_new (&x->x_obj, &x->threshold); 80 x->onsetval = outlet_new (&x->x_obj, &s_float); 98 x->onsetbang = outlet_new (&x->x_obj, &s_bang); 99 post(aubioonset_version); 81 100 return (void *)x; 82 101 } … … 98 117 CLASS_MAINSIGNALIN(aubioonset_tilde_class, 99 118 t_aubioonset_tilde, threshold); 100 post("aubioonset~ v0.1 for puredata");101 119 } 102 120 -
plugins/puredata/help-aubioonset~.pd
rf41f5c4 rcf83555 1 #N canvas 2 7 302 238 29210;1 #N canvas 245 501 672 291 10; 2 2 #X obj 50 33 adc~; 3 #X obj 59 137 vu 15 120 empty empty -1 -8 0 8 -66577 -1 1 0; 4 #X obj 58 109 scale 0 2000 -100 12; 5 #N canvas 270 196 450 300 aubioonset 1; 6 #X text 71 130 set blocksize to 1024 with 50% overlap; 7 #X obj 56 90 outlet; 8 #X obj 57 41 inlet~; 9 #X obj 55 64 aubioonset~ 0.1; 10 #X text 29 141 ugly. not required \, but should give better results 11 ; 12 #X obj 200 95 block~ 1024 2 1; 13 #X text 129 22 aubioonset~ takes an input signal and outputs the value 14 of the value of the onset detection function; 15 #X connect 2 0 3 0; 16 #X connect 3 0 1 0; 17 #X restore 58 78 pd aubioonset; 18 #X obj 108 141 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 19 -262144 -1 -1 1310.81 256; 20 #X connect 0 0 3 0; 21 #X connect 0 1 3 0; 22 #X connect 2 0 1 0; 23 #X connect 3 0 2 0; 24 #X connect 3 0 4 0; 3 #X text 181 26 aubioonset~ takes an input signal and outputs a bang 4 when an onset has been detected; 5 #X text 180 64 this is somewhat similar to the bonk~ object \, except 6 it should work on non-percussive attacks too.; 7 #X obj 50 97 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 8 -1; 9 #X text 182 111 the creation argument and right input can be used to 10 set the detection threshold. values between 0 and 10 are accepted. 11 low values favorise over-detection. higher values will reduce the number 12 of onset detected.; 13 #X obj 50 65 aubioonset~ 0.3; 14 #X floatatom 128 29 5 0 0 0 - - -; 15 #X connect 0 0 5 0; 16 #X connect 0 1 5 0; 17 #X connect 5 0 3 0; 18 #X connect 6 0 5 1;
Note: See TracChangeset
for help on using the changeset viewer.