Changeset ade9afe


Ignore:
Timestamp:
May 2, 2007, 3:10:42 PM (17 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:
416c0b5, 88199ce
Parents:
05468516
Message:

mathutils.c: indentation, remove tabs, no { at beginning of line, no spaces at end of line

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mathutils.c

    r05468516 rade9afe  
    3030    case aubio_win_rectangle:
    3131      for (i=0;i<size;i++)
    32         w[i] = 0.5; 
     32        w[i] = 0.5;
    3333      break;
    3434    case aubio_win_hamming:
     
    4848        w[i] = 0.42
    4949          - 0.50 * COS(    TWO_PI*i/(size-1.0))
    50           +     0.08 * COS(2.0*TWO_PI*i/(size-1.0));
     50          + 0.08 * COS(2.0*TWO_PI*i/(size-1.0));
    5151      break;
    5252    case aubio_win_blackman_harris:
    5353      for (i=0;i<size;i++)
    54         w[i] = 0.35875 
     54        w[i] = 0.35875
    5555          - 0.48829 * COS(    TWO_PI*i/(size-1.0))
    5656          + 0.14128 * COS(2.0*TWO_PI*i/(size-1.0))
     
    7474}
    7575
    76 
    7776smpl_t aubio_unwrap2pi(smpl_t phase) {
    7877  /* mod(phase+pi,-2pi)+pi */
     
    8079}
    8180
    82 
    83 smpl_t vec_mean(fvec_t *s)
    84 {
     81smpl_t vec_mean(fvec_t *s) {
    8582  uint_t i,j;
    8683  smpl_t tmp = 0.0f;
     
    9188}
    9289
    93 
    94 smpl_t vec_sum(fvec_t *s)
    95 {
     90smpl_t vec_sum(fvec_t *s) {
    9691  uint_t i,j;
    9792  smpl_t tmp = 0.0f;
     
    10297}
    10398
    104 
    105 smpl_t vec_max(fvec_t *s)
    106 {
     99smpl_t vec_max(fvec_t *s) {
    107100  uint_t i,j;
    108101  smpl_t tmp = 0.0f;
     
    113106}
    114107
    115 smpl_t vec_min(fvec_t *s)
    116 {
     108smpl_t vec_min(fvec_t *s) {
    117109  uint_t i,j;
    118110  smpl_t tmp = s->data[0][0];
     
    123115}
    124116
    125 
    126 uint_t vec_min_elem(fvec_t *s)
    127 {
     117uint_t vec_min_elem(fvec_t *s) {
    128118  uint_t i,j=0, pos=0.;
    129119  smpl_t tmp = s->data[0][0];
     
    136126}
    137127
    138 uint_t vec_max_elem(fvec_t *s)
    139 {
     128uint_t vec_max_elem(fvec_t *s) {
    140129  uint_t i,j=0, pos=0.;
    141130  smpl_t tmp = 0.0f;
     
    148137}
    149138
    150 void vec_shift(fvec_t *s)
    151 {
     139void vec_shift(fvec_t *s) {
    152140  uint_t i,j;
    153141  //smpl_t tmp = 0.0f;
     
    161149}
    162150
    163 smpl_t vec_local_energy(fvec_t * f)
    164 {
     151smpl_t vec_local_energy(fvec_t * f) {
    165152  smpl_t locE = 0.;
    166153  uint_t i,j;
     
    171158}
    172159
    173 smpl_t vec_local_hfc(fvec_t * f)
    174 {
     160smpl_t vec_local_hfc(fvec_t * f) {
    175161  smpl_t locE = 0.;
    176162  uint_t i,j;
     
    181167}
    182168
    183 smpl_t vec_alpha_norm(fvec_t * DF, smpl_t alpha)
    184 {
     169smpl_t vec_alpha_norm(fvec_t * DF, smpl_t alpha) {
    185170  smpl_t tmp = 0.;
    186171  uint_t i,j;
     
    191176}
    192177
    193 
    194 void vec_dc_removal(fvec_t * mag)
    195 {
     178void vec_dc_removal(fvec_t * mag) {
    196179    smpl_t mini = 0.;
    197180    uint_t length = mag->length, i=0, j;
     
    202185}
    203186
    204 
    205 void vec_alpha_normalise(fvec_t * mag, uint_t alpha)
    206 {
     187void vec_alpha_normalise(fvec_t * mag, uint_t alpha) {
    207188  smpl_t alphan = 1.;
    208189  uint_t length = mag->length, i=0, j;
     
    213194}
    214195
    215 
    216196void vec_add(fvec_t * mag, smpl_t threshold) {
    217197  uint_t length = mag->length, i=0, j;
     
    221201}
    222202
    223 
    224 void vec_adapt_thres(fvec_t * vec, fvec_t * tmp,
    225     uint_t post, uint_t pre)
    226 {
     203void vec_adapt_thres(fvec_t * vec, fvec_t * tmp,
     204    uint_t post, uint_t pre) {
    227205  uint_t length = vec->length, i=0, j;
    228206  for (j=0;j<length;j++) {
     
    232210
    233211smpl_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) {
    236213  smpl_t * medar = (smpl_t *)tmpvec->data[0];
    237214  uint_t k;
     
    240217  /* post part of the buffer does not exist */
    241218  if (pos<post+1) {
    242     for (k=0;k<post+1-pos;k++) 
     219    for (k=0;k<post+1-pos;k++)
    243220      medar[k] = 0.; /* 0-padding at the beginning */
    244221    for (k=post+1-pos;k<win_length;k++)
     
    252229    for (k=0;k<length-pos+post+1;k++)
    253230      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++)
    255232      medar[k] = 0.; /* 0-padding at the end */
    256   } 
     233  }
    257234  return vec_median(tmpvec);
    258235}
     
    321298    for (frac = 0.; frac < 2.; frac = frac + step) {
    322299      res = aubio_quadfrac(s0, s1, s2, frac);
    323       if (res > resold) 
     300      if (res > resold)
    324301        resold = res;
    325       else {                           
     302      else {
    326303        exactpos += (frac-step)*2. - 1.;
    327304        break;
     
    345322      if (res < resold) {
    346323        resold = res;
    347       } else {                         
     324      } else {
    348325        exactpos += (frac-step)*span - span/2.;
    349326        break;
     
    360337
    361338uint_t vec_peakpick(fvec_t * onset, uint_t pos) {
    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;
     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;
    368345}
    369346
    370347smpl_t aubio_freqtomidi(smpl_t freq) {
    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;
     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;
    377354}
    378355
    379356smpl_t aubio_miditofreq(smpl_t midi) {
    380         smpl_t freq = (midi+3.)/12.;
    381         freq = EXP(freq*0.69314718055995);
    382         freq *= 6.875;
    383         return freq;
     357  smpl_t freq = (midi+3.)/12.;
     358  freq = EXP(freq*0.69314718055995);
     359  freq *= 6.875;
     360  return freq;
    384361}
    385362
     
    404381}
    405382
    406 
    407 
    408 /** returns 1 if wassilence is 0 and RMS(ibuf)<threshold
     383/** returns 1 if wassilence is 0 and RMS(ibuf)<threshold
    409384 * \bug mono
    410385 */
     
    436411
    437412  if (loudness < threshold)
    438       return 1.;
     413    return 1.;
    439414  else
    440       return loudness;
     415    return loudness;
    441416}
    442417
     
    451426      }
    452427    //previous was positive
    453     } else if ( input->data[i][j] <= 0. ){
     428    } else if ( input->data[i][j] <= 0. ) {
    454429      zcr += 1;
    455430    }
     
    471446}
    472447
    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 {
     448void 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
     462void aubio_cleanup(void) {
    489463#if FFTW3_SUPPORT
    490         fftw_cleanup();
     464  fftw_cleanup();
    491465#else
    492466#if FFTW3F_SUPPORT
    493         fftwf_cleanup();
     467  fftwf_cleanup();
    494468#endif
    495469#endif
Note: See TracChangeset for help on using the changeset viewer.