Changeset b050e8e


Ignore:
Timestamp:
Nov 7, 2007, 5:15:45 PM (16 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:
18a82b3, 70585a5
Parents:
c8cbf3c
Message:

pitchmcomb.c: redo indentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pitchmcomb.c

    rc8cbf3c rb050e8e  
    9797  for (j=0; j< newmag->length; j++)
    9898    newmag->data[i][j]=fftgrain->norm[i][j];
    99   /* detect only if local energy > 10. */ 
     99  /* detect only if local energy > 10. */
    100100  //if (vec_local_energy(newmag)>10.) {
    101101    //hfc = vec_local_hfc(newmag); //not used
     
    106106  j = (uint_t)FLOOR(p->candidates[p->goodcandidate]->ebin+.5);
    107107  instfreq  = aubio_unwrap2pi(fftgrain->phas[0][j]
    108                   - p->theta->data[0][j] - j*p->phasediff);
     108      - p->theta->data[0][j] - j*p->phasediff);
    109109  instfreq *= p->phasefreq;
    110110  /* store phase for next run */
     
    119119}
    120120
    121 uint_t aubio_pitch_cands(aubio_pitchmcomb_t * p, cvec_t * fftgrain, 
     121uint_t aubio_pitch_cands(aubio_pitchmcomb_t * p, cvec_t * fftgrain,
    122122    smpl_t * cands) {
    123123  uint_t i=0,j;
    124124  uint_t k;
    125125  fvec_t * newmag = (fvec_t *)p->newmag;
    126   aubio_spectralcandidate_t ** scands = 
     126  aubio_spectralcandidate_t ** scands =
    127127    (aubio_spectralcandidate_t **)(p->candidates);
    128128  //smpl_t hfc; //fe=instfreq(theta1,theta,ops); //theta1=theta;
     
    130130  for (j=0; j< newmag->length; j++)
    131131    newmag->data[i][j]=fftgrain->norm[i][j];
    132   /* detect only if local energy > 10. */ 
    133   if (vec_local_energy(newmag)>10.)     {
     132  /* detect only if local energy > 10. */
     133  if (vec_local_energy(newmag)>10.) {
    134134    /* hfc = vec_local_hfc(newmag); do not use */
    135135    aubio_pitchmcomb_spectral_pp(p, newmag);
    136136    aubio_pitchmcomb_combdet(p,newmag);
    137137    aubio_pitchmcomb_sort_cand_freq(scands,p->ncand);
    138     /* store ncand comb energies in cands[1:ncand] */ 
    139     for (k = 0; k<p->ncand; k++) 
     138    /* store ncand comb energies in cands[1:ncand] */
     139    for (k = 0; k<p->ncand; k++)
    140140      cands[k] = p->candidates[k]->ene;
    141     /* store ncand[end] freq in cands[end] */ 
     141    /* store ncand[end] freq in cands[end] */
    142142    cands[p->ncand] = p->candidates[p->ncand-1]->ebin;
    143143    return 1;
     
    156156  /* copy newmag to mag (scracth) */
    157157  for (j=0;j<length;j++) {
    158     mag->data[i][j] = newmag->data[i][j]; 
     158    mag->data[i][j] = newmag->data[i][j];
    159159  }
    160160  vec_dc_removal(mag);               /* dc removal           */
     
    169169    /*  return bin and ebin */
    170170    count = aubio_pitchmcomb_quadpick(peaks,mag);
    171     for (j=0;j<count;j++) 
     171    for (j=0;j<count;j++)
    172172      peaks[j].mag = newmag->data[i][peaks[j].bin];
    173173    /* reset non peaks */
     
    181181void aubio_pitchmcomb_combdet(aubio_pitchmcomb_t * p, fvec_t * newmag) {
    182182  aubio_spectralpeak_t * peaks = (aubio_spectralpeak_t *)p->peaks;
    183   aubio_spectralcandidate_t ** candidate = 
     183  aubio_spectralcandidate_t ** candidate =
    184184    (aubio_spectralcandidate_t **)p->candidates;
    185185
     
    224224    for (k=0;k<curlen;k++) {
    225225      xx = 100000.;
    226       /** get the candidate->ecomb the closer to peaks.ebin 
     226      /** get the candidate->ecomb the closer to peaks.ebin
    227227       * (to cope with the inharmonicity)*/
    228       for (d=0;d<count;d++) { 
     228      for (d=0;d<count;d++) {
    229229        delta2 = ABS(candidate[l]->ecomb[k]-peaks[d].ebin);
    230230        if (delta2 <= xx) {
     
    233233        }
    234234      }
    235       /* for a Q factor of 17, maintaining "constant Q filtering", 
     235      /* for a Q factor of 17, maintaining "constant Q filtering",
    236236       * and sum energy and length over non null combs */
    237237      if ( 17. * xx < candidate[l]->ecomb[k] ) {
     
    261261 * exact peak positions are retrieved by quadratic interpolation
    262262 *
    263  * \bug peak-picking too picky, sometimes counts too many peaks ? 
     263 * \bug peak-picking too picky, sometimes counts too many peaks ?
    264264 */
    265265uint_t aubio_pitchmcomb_quadpick(aubio_spectralpeak_t * spectral_peaks, fvec_t * X){
    266266  uint_t i, j, ispeak, count = 0;
    267267  for (i=0;i<X->channels;i++)
    268     for (j=1;j<X->length-1;j++) {
     268    for (j=1;j<X->length-1;j++) {
    269269      ispeak = vec_peakpick(X,j);
    270270      if (ispeak) {
     
    290290
    291291void aubio_pitchmcomb_sort_peak(aubio_spectralpeak_t * peaks, uint_t nbins) {
    292   qsort(peaks, nbins, sizeof(aubio_spectralpeak_t), 
     292  qsort(peaks, nbins, sizeof(aubio_spectralpeak_t),
    293293      aubio_pitchmcomb_sort_peak_comp);
    294294}
Note: See TracChangeset for help on using the changeset viewer.