Changeset 3ec9d9c


Ignore:
Timestamp:
Aug 23, 2005, 12:53:38 AM (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:
4cc9fe5
Parents:
79c2e52
Message:

wrapper functions to add pitchm_bin output

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pitchdetection.c

    r79c2e52 r3ec9d9c  
    2828#include "pitchdetection.h"
    2929
    30 smpl_t freqconvpass(smpl_t f);
    31 smpl_t freqconvpass(smpl_t f){
    32         return f;
    33 }
    34 
    3530typedef smpl_t (*aubio_pitchdetection_func_t)(aubio_pitchdetection_t *p,
    3631                fvec_t * ibuf);
    37 typedef smpl_t (*aubio_pitchdetection_conv_t)(smpl_t value);
     32typedef smpl_t (*aubio_pitchdetection_conv_t)(smpl_t value,uint_t srate,uint_t bufsize);
    3833void aubio_pitchdetection_slideblock(aubio_pitchdetection_t *p, fvec_t *ibuf);
    3934
     
    5752};
    5853
     54/* convenience wrapper function for frequency unit conversions
     55 * should probably be rewritten with #defines */
     56smpl_t freqconvbin(smpl_t f,uint_t srate,uint_t bufsize);
     57smpl_t freqconvbin(smpl_t f,uint_t srate,uint_t bufsize){
     58        return aubio_freqtobin(f,srate,bufsize);
     59}
     60
     61smpl_t freqconvmidi(smpl_t f,uint_t srate,uint_t bufsize);
     62smpl_t freqconvmidi(smpl_t f,uint_t srate,uint_t bufsize){
     63        return aubio_freqtomidi(f);
     64}
     65
     66smpl_t freqconvpass(smpl_t f,uint_t srate,uint_t bufsize);
     67smpl_t freqconvpass(smpl_t f,uint_t srate,uint_t bufsize){
     68        return f;
     69}
     70
    5971aubio_pitchdetection_t * new_aubio_pitchdetection(uint_t bufsize,
    6072                uint_t hopsize,
     
    99111                        break;
    100112                case aubio_pitchm_midi:
    101                         p->freqconv = aubio_freqtomidi;
     113                        p->freqconv = freqconvmidi;
    102114                        break;
    103115                case aubio_pitchm_cent:
    104116                        /** bug: not implemented */
    105                         p->freqconv = freqconvpass;
     117                        p->freqconv = freqconvmidi;
    106118                        break;
    107119                case aubio_pitchm_bin:
    108                         /** bug: not implemented */
    109                         p->freqconv = freqconvpass;
     120                        p->freqconv = freqconvbin;
    110121                        break;
    111122                default:
     
    158169
    159170smpl_t aubio_pitchdetection(aubio_pitchdetection_t *p, fvec_t * ibuf) {
    160         return p->freqconv(p->callback(p,ibuf));
     171        return p->freqconv(p->callback(p,ibuf),p->srate,p->bufsize);
    161172}
    162173
Note: See TracChangeset for help on using the changeset viewer.