Ignore:
Timestamp:
Oct 8, 2009, 8:07:20 PM (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:
f162cf9
Parents:
8040cca
Message:

src/pitch/pitchmcomb.{c,h}: remove unused samplerate parameter, make multichannel, update prototypes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pitch/pitchmcomb.c

    r8040cca re5757cf  
    5252  smpl_t cutoff;                           /**< low-pass filter cutoff [0.34, 1]     */
    5353  smpl_t tol;                              /**< tolerance [0.05]                     */
    54   smpl_t tau;                              /**< frequency precision [44100/4096]     */
     54  // smpl_t tau;                              /**< frequency precision [44100/4096]     */
    5555  uint_t win_post;                         /**< median filter window length          */
    5656  uint_t win_pre;                          /**< median filter window                 */
     
    9292
    9393
    94 smpl_t aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, cvec_t * fftgrain) {
    95   uint_t i=0,j;
     94void aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, cvec_t * fftgrain, fvec_t * output) {
     95  uint_t i,j;
    9696  smpl_t instfreq;
    9797  fvec_t * newmag = (fvec_t *)p->newmag;
    9898  //smpl_t hfc; //fe=instfreq(theta1,theta,ops); //theta1=theta;
    9999  /* copy incoming grain to newmag */
     100  for (i=0; i< fftgrain->channels; i++) {
    100101  for (j=0; j< newmag->length; j++)
    101     newmag->data[i][j]=fftgrain->norm[i][j];
     102    newmag->data[0][j]=fftgrain->norm[i][j];
    102103  /* detect only if local energy > 10. */
    103104  //if (fvec_local_energy(newmag)>10.) {
     
    108109    //return p->candidates[p->goodcandidate]->ebin;
    109110  j = (uint_t)FLOOR(p->candidates[p->goodcandidate]->ebin+.5);
    110   instfreq  = aubio_unwrap2pi(fftgrain->phas[0][j]
    111       - p->theta->data[0][j] - j*p->phasediff);
     111  instfreq  = aubio_unwrap2pi(fftgrain->phas[i][j]
     112      - p->theta->data[i][j] - j*p->phasediff);
    112113  instfreq *= p->phasefreq;
    113114  /* store phase for next run */
     
    116117  }
    117118  //return p->candidates[p->goodcandidate]->ebin;
    118   return FLOOR(p->candidates[p->goodcandidate]->ebin+.5) + instfreq;
     119  output->data[i][0] = FLOOR(p->candidates[p->goodcandidate]->ebin+.5) + instfreq;
    119120  /*} else {
    120121    return -1.;
    121122  }*/
     123  }
    122124}
    123125
     
    327329}
    328330
    329 aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t bufsize, uint_t hopsize, uint_t channels, uint_t samplerate) {
     331aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t bufsize, uint_t hopsize, uint_t channels) {
    330332  aubio_pitchmcomb_t * p = AUBIO_NEW(aubio_pitchmcomb_t);
    331333  /* bug: should check if size / 8 > post+pre+1 */
     
    339341  p->win_post         = 8;
    340342  p->win_pre          = 7;
    341   p->tau              = samplerate/bufsize;
     343  // p->tau              = samplerate/bufsize;
    342344  p->alpha            = 9.;
    343345  p->goodcandidate    = 0;
     
    348350  //p->biquad = new_biquad(0.1600,0.3200,0.1600, -0.5949, 0.2348);
    349351  /* allocate temp memory */
    350   p->newmag     = new_fvec(spec_size,channels);
     352  p->newmag     = new_fvec(spec_size,1);
    351353  /* array for median */
    352   p->scratch    = new_fvec(spec_size,channels);
     354  p->scratch    = new_fvec(spec_size,1);
    353355  /* array for phase */
    354356  p->theta      = new_fvec(spec_size,channels);
    355357  /* array for adaptative threshold */
    356   p->scratch2   = new_fvec(p->win_post+p->win_pre+1,channels);
     358  p->scratch2   = new_fvec(p->win_post+p->win_pre+1,1);
    357359  /* array of spectral peaks */
    358360  p->peaks      = AUBIO_ARRAY(aubio_spectralpeak_t,spec_size);
Note: See TracChangeset for help on using the changeset viewer.