Changeset f8a38c5


Ignore:
Timestamp:
Mar 16, 2006, 4:42:11 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:
845f2d4
Parents:
fbd3de6
Message:

samplerate support, add filter for mcomb, yinthresh
samplerate support, add filter for mcomb, yinthresh

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/pitchdetection.c

    rfbd3de6 rf8a38c5  
    2121#include "phasevoc.h"
    2222#include "mathutils.h"
    23 //#include "filter.h"
     23#include "filter.h"
    2424#include "pitchmcomb.h"
    2525#include "pitchyin.h"
     
    4444        aubio_pitchfcomb_t * fcomb;
    4545        aubio_pitchschmitt_t * schmitt;
    46         //aubio_filter_t * filter;
     46        aubio_filter_t * filter;
    4747        /* for yin */
    4848        fvec_t * buf;
     
    5050        aubio_pitchdetection_func_t callback;
    5151        aubio_pitchdetection_conv_t freqconv;
     52        smpl_t yinthres;
    5253};
    5354
     
    8687                        p->yin      = new_fvec(bufsize/2,channels);
    8788                        p->callback = aubio_pitchdetection_yin;
     89                        p->yinthres = 0.2;
    8890                        break;
    8991                case aubio_pitch_mcomb:
    9092                        p->pv       = new_aubio_pvoc(bufsize, hopsize, channels);
    9193                        p->fftgrain = new_cvec(bufsize, channels);
    92                         p->mcomb    = new_aubio_pitchmcomb(bufsize,channels);
     94                        p->mcomb    = new_aubio_pitchmcomb(bufsize,channels,samplerate);
     95                        p->filter   = new_aubio_cdsgn_filter(samplerate);
    9396                        p->callback = aubio_pitchdetection_mcomb;
    9497                        break;
    9598                case aubio_pitch_fcomb:
    9699                        p->buf      = new_fvec(bufsize,channels);
    97                         p->fcomb    = new_aubio_pitchfcomb(bufsize,samplerate);
     100                        p->fcomb    = new_aubio_pitchfcomb(bufsize,hopsize,samplerate);
    98101                        p->callback = aubio_pitchdetection_fcomb;
    99102                        break;
     
    168171}
    169172
     173void aubio_pitchdetection_set_yinthresh(aubio_pitchdetection_t *p, smpl_t thres) {
     174        p->yinthres = thres;
     175}
     176
    170177smpl_t aubio_pitchdetection(aubio_pitchdetection_t *p, fvec_t * ibuf) {
    171178        return p->freqconv(p->callback(p,ibuf),p->srate,p->bufsize);
     
    174181smpl_t aubio_pitchdetection_mcomb(aubio_pitchdetection_t *p, fvec_t *ibuf) {
    175182        smpl_t pitch = 0.;
     183        aubio_filter_do(p->filter,ibuf);
    176184        aubio_pvoc_do(p->pv,ibuf,p->fftgrain);
    177185        pitch = aubio_pitchmcomb_detect(p->mcomb,p->fftgrain);
     
    188196        smpl_t pitch = 0.;
    189197        aubio_pitchdetection_slideblock(p,ibuf);
    190         pitch = aubio_pitchyin_getpitchfast(p->buf,p->yin, 0.5);
     198        pitch = aubio_pitchyin_getpitchfast(p->buf,p->yin, p->yinthres);
    191199        if (pitch>0) {
    192200                pitch = p->srate/(pitch+0.);
  • src/pitchdetection.h

    rfbd3de6 rf8a38c5  
    4646smpl_t aubio_pitchdetection_fcomb(aubio_pitchdetection_t *p, fvec_t *ibuf);
    4747
     48void aubio_pitchdetection_set_yinthresh(aubio_pitchdetection_t *p, smpl_t thres);
    4849void del_aubio_pitchdetection(aubio_pitchdetection_t * p);
    4950
Note: See TracChangeset for help on using the changeset viewer.