Changeset 650e39b for src


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

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

Location:
src
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    r4994ebb r650e39b  
    1818        pitchschmitt.h \
    1919        pitchfcomb.h \
     20        pitchyinfft.h \
    2021        beattracking.h \
    2122        filter.h
     
    5758        pitchfcomb.c \
    5859        pitchfcomb.h \
     60        pitchyinfft.c \
     61        pitchyinfft.h \
    5962        beattracking.c \
    6063        beattracking.h \
  • 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);
  • src/pitchdetection.h

    r4994ebb r650e39b  
    2828        aubio_pitch_mcomb,
    2929        aubio_pitch_schmitt,
    30         aubio_pitch_fcomb
     30        aubio_pitch_fcomb,
     31        aubio_pitch_yinfft
    3132} aubio_pitchdetection_type;
    3233
     
    4546smpl_t aubio_pitchdetection_schmitt(aubio_pitchdetection_t *p, fvec_t *ibuf);
    4647smpl_t aubio_pitchdetection_fcomb(aubio_pitchdetection_t *p, fvec_t *ibuf);
     48smpl_t aubio_pitchdetection_yinfft(aubio_pitchdetection_t *p, fvec_t *ibuf);
    4749
    4850void aubio_pitchdetection_set_yinthresh(aubio_pitchdetection_t *p, smpl_t thres);
Note: See TracChangeset for help on using the changeset viewer.