Ignore:
Timestamp:
Aug 22, 2005, 9:52: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:
c29dae2
Parents:
f97445c
Message:

added midi and hertz output modes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pitchdetection.c

    rf97445c raa17581  
    2828#include "pitchdetection.h"
    2929
     30smpl_t freqconvpass(smpl_t f);
     31smpl_t freqconvpass(smpl_t f){
     32        return f;
     33}
     34
    3035typedef smpl_t (*aubio_pitchdetection_func_t)(aubio_pitchdetection_t *p,
    3136                fvec_t * ibuf);
     37typedef smpl_t (*aubio_pitchdetection_conv_t)(smpl_t value);
    3238void aubio_pitchdetection_slideblock(aubio_pitchdetection_t *p, fvec_t *ibuf);
    3339
     
    4854        fvec_t * yin;
    4955        aubio_pitchdetection_func_t callback;
     56        aubio_pitchdetection_conv_t freqconv;
    5057};
    5158
     
    6067        p->srate = samplerate;
    6168        p->type = type;
     69        p->mode = mode;
    6270        p->bufsize = bufsize;
    6371        switch(p->type) {
     
    8694                        break;
    8795        }
     96        switch(p->mode) {
     97                case aubio_pitchm_freq:
     98                        p->freqconv = freqconvpass;
     99                        break;
     100                case aubio_pitchm_midi:
     101                        p->freqconv = aubio_freqtomidi;
     102                        break;
     103                case aubio_pitchm_cent:
     104                        /** bug: not implemented */
     105                        p->freqconv = freqconvpass;
     106                        break;
     107                case aubio_pitchm_bin:
     108                        /** bug: not implemented */
     109                        p->freqconv = freqconvpass;
     110                        break;
     111                default:
     112                        break;
     113        }
    88114        return p;
    89115}
     
    132158
    133159smpl_t aubio_pitchdetection(aubio_pitchdetection_t *p, fvec_t * ibuf) {
    134         return p->callback(p,ibuf);
     160        return p->freqconv(p->callback(p,ibuf));
    135161}
    136162
Note: See TracChangeset for help on using the changeset viewer.