Changeset f1b6aad for src/spectral/tss.c


Ignore:
Timestamp:
Oct 16, 2009, 4:02:01 AM (15 years ago)
Author:
Paul Brossier <piem@piem.org>
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
Message:

src/spectral/tss.c: simplify new_ method, add setters for threshold, alpha, and beta

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/spectral/tss.c

    r28c162c rf1b6aad  
    1818*/
    1919
    20 /* default values : alfa=4, beta=3, threshold=0.25 */
     20/* default values : alpha=4, beta=3, threshold=0.25 */
    2121
    2222#include "aubio_priv.h"
     
    2626#include "spectral/tss.h"
    2727
    28 struct _aubio_tss_t 
     28struct _aubio_tss_t
    2929{
    30   smpl_t thrs;
    31   smpl_t alfa;
     30  smpl_t threshold;
     31  smpl_t alpha;
    3232  smpl_t beta;
    3333  smpl_t parm;
     
    4444{
    4545  uint_t i,j;
    46   uint_t test; 
     46  uint_t test;
    4747  uint_t nbins     = input->length;
    4848  uint_t channels  = input->channels;
    49   smpl_t alfa      = o->alfa;
     49  smpl_t alpha     = o->alpha;
    5050  smpl_t beta      = o->beta;
    5151  smpl_t parm      = o->parm;
     
    8383      oft2[i][j]  = test;
    8484      test = (trans->norm[i][j]>0.);
    85       oft1[i][j] += alfa*test;
     85      oft1[i][j] += alpha*test;
    8686      test = (stead->norm[i][j]>0.);
    87       oft2[i][j] += alfa*test;
     87      oft2[i][j] += alpha*test;
    8888      test = (oft1[i][j]>1. && trans->norm[i][j]>0.);
    8989      oft1[i][j] += beta*test;
     
    9494}
    9595
    96 void aubio_tss_set_thres(aubio_tss_t *o, smpl_t thrs){
    97         o->thrs = thrs;
    98         o->parm = thrs*o->thrsfact;
     96uint_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;
    99100}
    100101
    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)
     102aubio_tss_t * new_aubio_tss(uint_t buf_size, uint_t hop_size, uint_t channels)
    103103{
    104104  aubio_tss_t * o = AUBIO_NEW(aubio_tss_t);
    105   uint_t rsize = size/2+1;
    106   o->thrs = thrs;
    107   o->thrsfact = TWO_PI*overlap/rsize;
    108   o->alfa = 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;
    111111  o->theta1 = new_fvec(rsize,channels);
    112112  o->theta2 = new_fvec(rsize,channels);
     
    127127}
    128128
     129uint_t aubio_tss_set_alpha(aubio_tss_t *o, smpl_t alpha){
     130  o->alpha = alpha;
     131  return AUBIO_OK;
     132}
     133
     134uint_t aubio_tss_set_beta(aubio_tss_t *o, smpl_t beta){
     135  o->beta = beta;
     136  return AUBIO_OK;
     137}
     138
Note: See TracChangeset for help on using the changeset viewer.