Changeset d8604ac for src


Ignore:
Timestamp:
Mar 16, 2006, 4:35:51 PM (18 years ago)
Author:
Paul Brossier <piem@altern.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:
8595fe3
Parents:
5d1c070
Message:

activate adapt thresh, reduce numb partials for high frequencies, add support for samplerate
activate adapt thresh, reduce numb partials for high frequencies, add support for samplerate

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/pitchmcomb.c

    r5d1c070 rd8604ac  
    9494    newmag->data[i][j]=fftgrain->norm[i][j];
    9595  /* detect only if local energy > 10. */
    96   if (vec_local_energy(newmag)>10.) {
     96  //if (vec_local_energy(newmag)>10.) {
    9797    //hfc = vec_local_hfc(newmag); //not used
    9898    aubio_pitchmcomb_spectral_pp(p, newmag);
    9999    aubio_pitchmcomb_combdet(p,newmag);
     100    //aubio_pitchmcomb_sort_cand_freq(p->candidates,p->ncand);
    100101    // print picked candidate
    101102    //AUBIO_DBG("%f\n",p->candidates[p->goodcandidate]->ebin);
    102103    //AUBIO_DBG("%f\n",p->candidates[p->goodcandidate]->ebin);
    103104    return p->candidates[p->goodcandidate]->ebin;
    104   } else {
     105  /*} else {
    105106    return -1.;
    106   }
     107  }*/
    107108}
    108109
     
    139140void aubio_pitchmcomb_spectral_pp(aubio_pitchmcomb_t * p, fvec_t * newmag) {
    140141  fvec_t * mag = (fvec_t *)p->scratch;
    141   //fvec_t * tmp = (fvec_t *)p->scratch2;
     142  fvec_t * tmp = (fvec_t *)p->scratch2;
    142143  uint_t i=0,j;
    143144  uint_t length = mag->length;
     
    150151  /* skipped */                      /* low pass filtering   */
    151152  /** \bug: vec_movind_thres writes out of bounds */
    152   //vec_adapt_thres(mag,tmp,p->win_post,p->win_pre); /* adaptative threshold */
     153  vec_adapt_thres(mag,tmp,p->win_post,p->win_pre); /* adaptative threshold */
    153154  vec_add(mag,-p->threshold);        /* fixed threshold      */
    154155  {
     
    192193  /* get the biggest peak in the spectrum */
    193194  root_peak = aubio_pitchmcomb_get_root_peak(peaks,count);
     195  if (peaks[root_peak].ebin > aubio_miditofreq(80.)/p->tau) N = 3;
     196  if (peaks[root_peak].ebin > aubio_miditofreq(85.)/p->tau) N = 2;
     197  if (peaks[root_peak].ebin > aubio_miditofreq(90.)/p->tau) N = 1;
    194198  /* now calculate the energy of each of the 5 combs */
    195199  for (l=0;l<M;l++) {
     
    208212    /* for each in candidate[l]->ecomb[k] */
    209213    for (k=0;k<curlen;k++) {
    210       xx = 10000.;
     214      xx = 100000.;
    211215      /** get the candidate->ecomb the closer to peaks.ebin
    212216       * (to cope with the inharmonicity)*/
     
    255259        count += ispeak;
    256260        spectral_peaks[count-1].bin = j;
    257         spectral_peaks[count-1].ebin = vec_quadint(X,j);
     261        spectral_peaks[count-1].ebin = vec_quadint(X,j) - 1.;
    258262      }
    259263    }
     
    307311}
    308312
    309 aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t size, uint_t channels) {
     313aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t size, uint_t channels, uint_t samplerate) {
    310314  aubio_pitchmcomb_t * p = AUBIO_NEW(aubio_pitchmcomb_t);
    311315  /** \bug should check if size / 8 > post+pre+1 */
    312316  uint_t i;
    313317  uint_t spec_size;
    314   p->spec_partition   = 2;
     318  p->spec_partition   = 4;
    315319  p->ncand            = 5;
    316   p->npartials        = 10;
     320  p->npartials        = 5;
    317321  p->cutoff           = 1.;
    318322  p->threshold        = 0.01;
    319323  p->win_post         = 8;
    320324  p->win_pre          = 7;
    321   p->tau              = 44100./size;
     325  p->tau              = samplerate/size;
    322326  p->alpha            = 9.;
    323327  p->goodcandidate    = 0;
  • src/pitchmcomb.h

    r5d1c070 rd8604ac  
    3535smpl_t aubio_pitchmcomb_detect(aubio_pitchmcomb_t * p, cvec_t * fftgrain);
    3636uint_t aubio_pitch_cands(aubio_pitchmcomb_t * p, cvec_t * fftgrain, smpl_t * cands);
    37 aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t size, uint_t channels);
     37aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t size, uint_t channels, uint_t samplerate);
    3838void del_aubio_pitchmcomb(aubio_pitchmcomb_t *p);
    3939
Note: See TracChangeset for help on using the changeset viewer.