Changeset cf7c76a for src/pitchyin.c


Ignore:
Timestamp:
Apr 11, 2005, 6:31:48 PM (19 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:
84941cb
Parents:
a0fd4e4
Message:

update pitchyin.[ch] and pitchdetection.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pitchyin.c

    ra0fd4e4 rcf7c76a  
    8383                tau++;
    8484        } while (tau<yin->length);
    85         //AUBIO_DBG("No pitch found");
     85        AUBIO_DBG("No pitch found");
    8686        return 0;
    8787}
     
    8989
    9090/* all the above in one */
    91 uint_t aubio_pitchyin_getpitchfast(fvec_t * input, fvec_t * yin){
    92         uint_t c,j,tau = 0;
     91uint_t aubio_pitchyin_getpitchfast(fvec_t * input, fvec_t * yin, smpl_t tol){
     92        uint_t c=0,j,tau = 0;
    9393        smpl_t tmp = 0, tmp2;
    94         for (c=0;c<input->channels;c++)
     94        for (tau=0;tau<yin->length;tau++)
    9595        {
    96                 for (tau=0;tau<yin->length;tau++)
     96                yin->data[c][tau] = 0.;
     97        }
     98        for (tau=1;tau<yin->length;tau++)
     99        {
     100                for (j=0;j<yin->length;j++)
    97101                {
    98                         yin->data[c][tau] = 0.;
    99                 }
    100                 for (tau=1;tau<yin->length;tau++)
    101                 {
    102                         for (j=0;j<yin->length;j++)
    103                         {
    104                                 tmp = input->data[c][j] - input->data[c][j+tau];
    105                                 yin->data[c][tau] += SQR(tmp);
    106                         }
    107                 }
    108                 tmp2 = 0.;
    109                 yin->data[c][0] = 1.;
    110                 for (tau=1;tau<yin->length;tau++)
    111                 {
    112                         tmp += yin->data[c][tau];
    113                         yin->data[c][tau] *= tau/tmp;
     102                        tmp = input->data[c][j] - input->data[c][j+tau];
     103                        yin->data[c][tau] += SQR(tmp);
    114104                }
    115105        }
     106        tmp2 = 0.;
     107        yin->data[c][0] = 1.;
     108        for (tau=1;tau<yin->length;tau++)
     109        {
     110                tmp += yin->data[c][tau];
     111                yin->data[c][tau] *= tau/tmp;
     112        }
    116113        /* should merge the following with above */
     114        tau = 1;
    117115        do
    118116        {
    119                 if(yin->data[c][tau] < 0.1) {
     117                if(yin->data[c][tau] < tol) {
    120118                        while (yin->data[c][tau+1] < yin->data[c][tau]) {
    121119                                tau++;
Note: See TracChangeset for help on using the changeset viewer.