Ignore:
Timestamp:
Dec 5, 2018, 10:34:39 PM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/cnn, feature/crepe, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
Children:
283a619a
Parents:
5b46bc3 (diff), f19db54 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into feature/pitchshift

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pitch/pitchyinfft.c

    r5b46bc3 r633400d  
    3737  fvec_t *yinfft;     /**< Yin function */
    3838  smpl_t tol;         /**< Yin tolerance */
    39   smpl_t confidence;  /**< confidence */
     39  uint_t peak_pos;    /**< currently selected peak pos*/
    4040  uint_t short_period; /** shortest period under which to check for octave error */
    4141};
     
    4545   160.,   200.,   250.,   315.,   400.,   500.,   630.,   800.,  1000.,  1250.,
    4646  1600.,  2000.,  2500.,  3150.,  4000.,  5000.,  6300.,  8000.,  9000., 10000.,
    47  12500., 15000., 20000., 25100
     47 12500., 15000., 20000., 25100., -1.
    4848};
    4949
     
    6363  p->winput = new_fvec (bufsize);
    6464  p->fft = new_aubio_fft (bufsize);
     65  if (!p->fft) goto beach;
    6566  p->fftout = new_fvec (bufsize);
    6667  p->sqrmag = new_fvec (bufsize);
    6768  p->yinfft = new_fvec (bufsize / 2 + 1);
    6869  p->tol = 0.85;
     70  p->peak_pos = 0;
    6971  p->win = new_aubio_window ("hanningz", bufsize);
    7072  p->weight = new_fvec (bufsize / 2 + 1);
    7173  for (i = 0; i < p->weight->length; i++) {
    7274    freq = (smpl_t) i / (smpl_t) bufsize *(smpl_t) samplerate;
    73     while (freq > freqs[j]) {
     75    while (freq > freqs[j] && freqs[j] > 0) {
     76      //AUBIO_DBG("freq %3.5f > %3.5f \tsamplerate %d (Hz) \t"
     77      //    "(weight length %d, bufsize %d) %d %d\n", freq, freqs[j],
     78      //    samplerate, p->weight->length, bufsize, i, j);
    7479      j += 1;
    7580    }
     
    96101  p->short_period = (uint_t)ROUND(samplerate / 1300.);
    97102  return p;
     103
     104beach:
     105  if (p->winput) del_fvec(p->winput);
     106  AUBIO_FREE(p);
     107  return NULL;
    98108}
    99109
     
    156166      halfperiod = FLOOR (tau / 2 + .5);
    157167      if (yin->data[halfperiod] < p->tol)
    158         output->data[0] = fvec_quadratic_peak_pos (yin, halfperiod);
     168        p->peak_pos = halfperiod;
    159169      else
    160         output->data[0] = fvec_quadratic_peak_pos (yin, tau);
     170        p->peak_pos = tau;
     171      output->data[0] = fvec_quadratic_peak_pos (yin, p->peak_pos);
    161172    }
    162173  } else {
     174    p->peak_pos = 0;
    163175    output->data[0] = 0.;
    164176  }
     
    180192smpl_t
    181193aubio_pitchyinfft_get_confidence (aubio_pitchyinfft_t * o) {
    182   o->confidence = 1. - fvec_min (o->yinfft);
    183   return o->confidence;
     194  return 1. - o->yinfft->data[o->peak_pos];
    184195}
    185196
Note: See TracChangeset for help on using the changeset viewer.