Changeset f1b6aad
- Timestamp:
- Oct 16, 2009, 4:02:01 AM (15 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:
- 6338636
- Parents:
- 28c162c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/puredata/aubiotss~.c
r28c162c rf1b6aad 21 21 t_object x_obj; 22 22 t_float thres; 23 t_float alpha;24 t_float beta;25 23 t_int pos; /*frames%dspblocksize*/ 26 24 t_int bufsize; … … 55 53 //if (!aubio_silence_detection(x->vec, x->threshold2)) 56 54 aubio_pvoc_do (x->pv, x->vec, x->fftgrain); 57 aubio_tss_set_thres ( x->tss, x->thres);55 aubio_tss_set_threshold ( x->tss, x->thres); 58 56 aubio_tss_do (x->tss, x->fftgrain, x->ctrans, x->cstead); 59 57 aubio_pvoc_rdo (x->pvt, x->ctrans, x->trans); … … 94 92 x->bufsize = 1024; //(bufsize < 64) ? 1024: (bufsize > 16385) ? 16385: bufsize; 95 93 x->hopsize = x->bufsize / 4; 96 x->alpha = 3.;97 x->beta = 4.;98 94 99 95 x->vec = (fvec_t *)new_fvec(x->hopsize,1); … … 110 106 x->pvs = (aubio_pvoc_t *)new_aubio_pvoc(x->bufsize, x->hopsize, 1); 111 107 112 x->tss = (aubio_tss_t *)new_aubio_tss(x->thres, x->alpha, x->beta, 113 x->bufsize, x->hopsize, 1); 108 x->tss = (aubio_tss_t *)new_aubio_tss(x->bufsize, x->hopsize, 1); 114 109 115 110 floatinlet_new (&x->x_obj, &x->thres); -
src/spectral/tss.c
r28c162c rf1b6aad 18 18 */ 19 19 20 /* default values : al fa=4, beta=3, threshold=0.25 */20 /* default values : alpha=4, beta=3, threshold=0.25 */ 21 21 22 22 #include "aubio_priv.h" … … 26 26 #include "spectral/tss.h" 27 27 28 struct _aubio_tss_t 28 struct _aubio_tss_t 29 29 { 30 smpl_t thr s;31 smpl_t al fa;30 smpl_t threshold; 31 smpl_t alpha; 32 32 smpl_t beta; 33 33 smpl_t parm; … … 44 44 { 45 45 uint_t i,j; 46 uint_t test; 46 uint_t test; 47 47 uint_t nbins = input->length; 48 48 uint_t channels = input->channels; 49 smpl_t al fa = o->alfa;49 smpl_t alpha = o->alpha; 50 50 smpl_t beta = o->beta; 51 51 smpl_t parm = o->parm; … … 83 83 oft2[i][j] = test; 84 84 test = (trans->norm[i][j]>0.); 85 oft1[i][j] += al fa*test;85 oft1[i][j] += alpha*test; 86 86 test = (stead->norm[i][j]>0.); 87 oft2[i][j] += al fa*test;87 oft2[i][j] += alpha*test; 88 88 test = (oft1[i][j]>1. && trans->norm[i][j]>0.); 89 89 oft1[i][j] += beta*test; … … 94 94 } 95 95 96 void aubio_tss_set_thres(aubio_tss_t *o, smpl_t thrs){ 97 o->thrs = thrs; 98 o->parm = thrs*o->thrsfact; 96 uint_t aubio_tss_set_threshold(aubio_tss_t *o, smpl_t threshold){ 97 o->threshold = threshold; 98 o->parm = o->threshold * o->thrsfact; 99 return AUBIO_OK; 99 100 } 100 101 101 aubio_tss_t * new_aubio_tss(smpl_t thrs, smpl_t alfa, smpl_t beta, 102 uint_t size, uint_t overlap,uint_t channels) 102 aubio_tss_t * new_aubio_tss(uint_t buf_size, uint_t hop_size, uint_t channels) 103 103 { 104 104 aubio_tss_t * o = AUBIO_NEW(aubio_tss_t); 105 uint_t rsize = size/2+1;106 o->thr s = thrs;107 o->thrsfact = TWO_PI* overlap/rsize;108 o->al fa = alfa;109 o->beta = beta;110 o->parm = thrs*o->thrsfact;105 uint_t rsize = buf_size/2+1; 106 o->threshold = 0.25; 107 o->thrsfact = TWO_PI*hop_size/rsize; 108 o->alpha = 3.; 109 o->beta = 4.; 110 o->parm = o->threshold*o->thrsfact; 111 111 o->theta1 = new_fvec(rsize,channels); 112 112 o->theta2 = new_fvec(rsize,channels); … … 127 127 } 128 128 129 uint_t aubio_tss_set_alpha(aubio_tss_t *o, smpl_t alpha){ 130 o->alpha = alpha; 131 return AUBIO_OK; 132 } 133 134 uint_t aubio_tss_set_beta(aubio_tss_t *o, smpl_t beta){ 135 o->beta = beta; 136 return AUBIO_OK; 137 } 138 -
src/spectral/tss.h
r28c162c rf1b6aad 28 28 transient information in musical audio using multiresolution analysis 29 29 techniques. In Proceedings of the Digital Audio Effects Conference, DAFx-01, 30 pages 15, Limerick, Ireland, 2001. 30 pages 1--5, Limerick, Ireland, 2001. 31 32 Available at http://www.csis.ul.ie/dafx01/proceedings/papers/duxbury.pdf 31 33 32 34 */ … … 39 41 #endif 40 42 41 /** T SSobject */43 /** Transient / Steady-state Separation object */ 42 44 typedef struct _aubio_tss_t aubio_tss_t; 43 45 44 46 /** create tss object 45 47 46 \param thrs separation threshold 47 \param alfa alfa parameter 48 \param beta beta parameter 49 \param size buffer size 50 \param overlap step size 48 \param win_s buffer size 49 \param hop_s step size 51 50 \param channels number of input channels 52 51 53 52 */ 54 aubio_tss_t * new_aubio_tss(smpl_t thrs, smpl_t alfa, smpl_t beta,55 uint_t win_s, uint_t hop_s, uint_t channels); 53 aubio_tss_t *new_aubio_tss (uint_t win_s, uint_t hop_s, uint_t channels); 54 56 55 /** delete tss object 57 56 58 \param s tss object as returned by new_aubio_tss57 \param o tss object as returned by new_aubio_tss() 59 58 60 59 */ 61 void del_aubio_tss (aubio_tss_t *s);60 void del_aubio_tss (aubio_tss_t * o); 62 61 63 /** set transient / steady state separation threshold64 65 \param tss tss object as returned by new_aubio_tss66 \param thrs new threshold value67 68 */69 void aubio_tss_set_thres(aubio_tss_t *tss, smpl_t thrs);70 62 /** split input into transient and steady states components 71 63 72 \param s tss object as returned by new_aubio_tss64 \param o tss object as returned by new_aubio_tss() 73 65 \param input input spectral frame 74 66 \param trans output transient components … … 76 68 77 69 */ 78 void aubio_tss_do(aubio_tss_t *s, cvec_t * input, cvec_t * trans, cvec_t * stead); 70 void aubio_tss_do (aubio_tss_t * o, cvec_t * input, cvec_t * trans, 71 cvec_t * stead); 72 73 /** set transient / steady state separation threshold 74 75 \param o tss object as returned by new_aubio_tss() 76 \param thrs new threshold value 77 78 */ 79 uint_t aubio_tss_set_threshold (aubio_tss_t * o, smpl_t thrs); 80 81 /** set parameter a, defaults to 3 82 83 \param o tss object as returned by new_aubio_tss() 84 \param alpha new value for alpha parameter 85 86 */ 87 uint_t aubio_tss_set_alpha (aubio_tss_t * o, smpl_t alpha); 88 89 /** set parameter b, defaults to 3 90 91 \param o tss object as returned by new_aubio_tss() 92 \param beta new value for beta parameter 93 94 */ 95 uint_t aubio_tss_set_beta (aubio_tss_t * o, smpl_t beta); 79 96 80 97 #ifdef __cplusplus -
tests/src/test-tss.c
r28c162c rf1b6aad 26 26 aubio_pvoc_t * pvs = new_aubio_pvoc(win_s,hop_s,channels); 27 27 28 aubio_tss_t * tss = new_aubio_tss( 0.01,3.,4.,win_s,hop_s,channels);28 aubio_tss_t * tss = new_aubio_tss(win_s,hop_s,channels); 29 29 /* fill input with some data */ 30 30 printf("initialised\n");
Note: See TracChangeset
for help on using the changeset viewer.