Ignore:
Timestamp:
Mar 21, 2006, 11:59:17 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:
4798fdf
Parents:
4994ebb
Message:

add yinfft method, make it default for pd plugin
add yinfft method, make it default for pd plugin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pitchdetection.c

    r4994ebb r650e39b  
    2626#include "pitchfcomb.h"
    2727#include "pitchschmitt.h"
     28#include "pitchyinfft.h"
    2829#include "pitchdetection.h"
    2930
     
    4445        aubio_pitchfcomb_t * fcomb;
    4546        aubio_pitchschmitt_t * schmitt;
     47        aubio_pitchyinfft_t * yinfft;
    4648        aubio_filter_t * filter;
    4749        /* for yin */
     
    9294                        p->pv       = new_aubio_pvoc(bufsize, hopsize, channels);
    9395                        p->fftgrain = new_cvec(bufsize, channels);
    94                         p->mcomb    = new_aubio_pitchmcomb(bufsize,channels,samplerate);
     96                        p->mcomb    = new_aubio_pitchmcomb(bufsize,hopsize,channels,samplerate);
    9597                        p->filter   = new_aubio_cdsgn_filter(samplerate);
    9698                        p->callback = aubio_pitchdetection_mcomb;
     
    105107                        p->schmitt  = new_aubio_pitchschmitt(bufsize,samplerate);
    106108                        p->callback = aubio_pitchdetection_schmitt;
     109                        break;
     110                case aubio_pitch_yinfft:
     111                        p->buf      = new_fvec(bufsize,channels);
     112                        p->yinfft   = new_aubio_pitchyinfft(bufsize);
     113                        p->callback = aubio_pitchdetection_yinfft;
     114                        p->yinthres = 0.2;
    107115                        break;
    108116                default:
     
    147155                        del_fvec(p->buf);
    148156                        del_aubio_pitchfcomb(p->fcomb);
     157                        break;
     158                case aubio_pitch_yinfft:
     159                        del_fvec(p->buf);
     160                        del_aubio_pitchyinfft(p->yinfft);
    149161                        break;
    150162                default:
     
    206218
    207219
     220smpl_t aubio_pitchdetection_yinfft(aubio_pitchdetection_t *p, fvec_t *ibuf){
     221        smpl_t pitch = 0.;
     222        aubio_pitchdetection_slideblock(p,ibuf);
     223        pitch = aubio_pitchyinfft_detect(p->yinfft,p->buf,p->yinthres);
     224        if (pitch>0) {
     225                pitch = p->srate/(pitch+0.);
     226        } else {
     227                pitch = 0.;
     228        }
     229        return pitch;
     230}
     231
    208232smpl_t aubio_pitchdetection_fcomb(aubio_pitchdetection_t *p, fvec_t *ibuf){
    209233        aubio_pitchdetection_slideblock(p,ibuf);
Note: See TracChangeset for help on using the changeset viewer.