Changeset ca1abdd


Ignore:
Timestamp:
Oct 19, 2009, 10:51:59 AM (15 years ago)
Author:
Paul Brossier <piem@piem.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:
b14107f
Parents:
9f07d52
Message:

rename aubio_pitchdetection to aubio_pitch

Files:
10 edited
2 moved

Legend:

Unmodified
Added
Removed
  • plugins/puredata/aubiopitch~.c

    r9f07d52 rca1abdd  
    2626        t_int bufsize;
    2727        t_int hopsize;
    28         aubio_pitchdetection_t *o;
     28        aubio_pitch_t *o;
    2929        fvec_t *vec;
    3030        fvec_t *pitchvec;
     
    4444                if (x->pos == x->hopsize-1) {         
    4545                        /* block loop */
    46                         aubio_pitchdetection_do(x->o,x->vec, x->pitchvec);
     46                        aubio_pitch_do(x->o,x->vec, x->pitchvec);
    4747                        outlet_float(x->pitch, x->pitchvec->data[0][0]);
    4848                        /* end of block loop */
     
    7777
    7878        //FIXME: get the real samplerate
    79     x->o = new_aubio_pitchdetection(s->s_name, x->bufsize,
     79    x->o = new_aubio_pitch(s->s_name, x->bufsize,
    8080            x->hopsize, 1, 44100.);
    81         aubio_pitchdetection_set_tolerance (x->o, 0.7);
     81        aubio_pitch_set_tolerance (x->o, 0.7);
    8282        x->vec = (fvec_t *)new_fvec(x->hopsize,1);
    8383        x->pitchvec = (fvec_t *)new_fvec(1,1);
     
    9292static void *aubiopitch_tilde_del(t_aubiopitch_tilde *x)
    9393{
    94         del_aubio_pitchdetection(x->o);
     94        del_aubio_pitch(x->o);
    9595        del_fvec(x->vec);
    9696        del_fvec(x->pitchvec);
  • python/aubio/aubioclass.py

    r9f07d52 rca1abdd  
    127127        return isonset, dval
    128128
    129 class pitchdetection:
     129class pitch:
    130130    def __init__(self,mode="mcomb",bufsize=2048,hopsize=1024,
    131131        channels=1,samplerate=44100.,omode="freq",tolerance=0.1):
    132         self.pitchp = new_aubio_pitchdetection(mode,bufsize,hopsize,channels,
     132        self.pitchp = new_aubio_pitch(mode,bufsize,hopsize,channels,
    133133            samplerate)
    134134        self.mypitch = fvec(1, channels)
    135         aubio_pitchdetection_set_unit(self.pitchp,omode)
    136         aubio_pitchdetection_set_tolerance(self.pitchp,tolerance)
     135        aubio_pitch_set_unit(self.pitchp,omode)
     136        aubio_pitch_set_tolerance(self.pitchp,tolerance)
    137137        #self.filt     = filter(srate,"adsgn")
    138138    def __del__(self):
    139         del_aubio_pitchdetection(self.pitchp)
     139        del_aubio_pitch(self.pitchp)
    140140    def __call__(self,myvec):
    141         aubio_pitchdetection_do(self.pitchp,myvec(), self.mypitch())
     141        aubio_pitch_do(self.pitchp,myvec(), self.mypitch())
    142142        return self.mypitch.get(0,0)
    143143
  • python/aubio/task/notes.py

    r9f07d52 rca1abdd  
    1414                        dcthreshold=self.params.dcthreshold,
    1515                        derivate=self.params.derivate)
    16                 self.pitchdet  = pitchdetection(mode=self.params.pitchmode,
     16                self.pitchdet  = pitch(mode=self.params.pitchmode,
    1717                        bufsize=self.params.pbufsize,
    1818                        hopsize=self.params.phopsize,
  • python/aubio/task/pitch.py

    r9f07d52 rca1abdd  
    1313                else:
    1414                        tolerance = 0.
    15                 self.pitchdet   = pitchdetection(mode=self.params.pitchmode,
     15                self.pitchdet   = pitch(mode=self.params.pitchmode,
    1616                        bufsize=self.params.bufsize,
    1717                        hopsize=self.params.hopsize,
  • src/Makefile.am

    r9f07d52 rca1abdd  
    2424        spectral/tss.h \
    2525        spectral/spectral_centroid.h \
    26         pitch/pitchdetection.h \
     26        pitch/pitch.h \
    2727        pitch/pitchmcomb.h \
    2828        pitch/pitchyin.h \
     
    5959        spectral/tss.c \
    6060        spectral/spectral_centroid.c \
    61         pitch/pitchdetection.c \
     61        pitch/pitch.c \
    6262        pitch/pitchmcomb.c \
    6363        pitch/pitchyin.c \
  • src/aubio.h

    r9f07d52 rca1abdd  
    8282#include "spectral/phasevoc.h"
    8383#include "spectral/spectral_centroid.h"
    84 #include "pitch/pitchdetection.h"
     84#include "pitch/pitch.h"
    8585#include "pitch/pitchmcomb.h"
    8686#include "pitch/pitchyin.h"
  • src/pitch/pitch.c

    r9f07d52 rca1abdd  
    3030#include "pitch/pitchschmitt.h"
    3131#include "pitch/pitchyinfft.h"
    32 #include "pitch/pitchdetection.h"
     32#include "pitch/pitch.h"
    3333
    3434/** pitch detection algorithm */
    3535typedef enum {
    36   aubio_pitch_yin,     /**< YIN algorithm */
    37   aubio_pitch_mcomb,   /**< Multi-comb filter */
    38   aubio_pitch_schmitt, /**< Schmitt trigger */
    39   aubio_pitch_fcomb,   /**< Fast comb filter */
    40   aubio_pitch_yinfft,   /**< Spectral YIN */
    41   aubio_pitch_default = aubio_pitch_yinfft, /**< the one used when "default" is asked */
    42 } aubio_pitchdetection_type;
     36  aubio_pitcht_yin,     /**< YIN algorithm */
     37  aubio_pitcht_mcomb,   /**< Multi-comb filter */
     38  aubio_pitcht_schmitt, /**< Schmitt trigger */
     39  aubio_pitcht_fcomb,   /**< Fast comb filter */
     40  aubio_pitcht_yinfft,   /**< Spectral YIN */
     41  aubio_pitcht_default = aubio_pitcht_yinfft, /**< the one used when "default" is asked */
     42} aubio_pitch_type;
    4343
    4444/** pitch detection output mode */
     
    4949  aubio_pitchm_bin,    /**< Frequency bin (0,bufsize) */
    5050  aubio_pitchm_default = aubio_pitchm_freq, /**< the one used when "default" is asked */
    51 } aubio_pitchdetection_mode;
    52 
    53 typedef void (*aubio_pitchdetection_func_t)
    54   (aubio_pitchdetection_t *p, fvec_t * ibuf, fvec_t *obuf);
    55 typedef smpl_t (*aubio_pitchdetection_conv_t)
     51} aubio_pitch_mode;
     52
     53typedef void (*aubio_pitch_func_t)
     54  (aubio_pitch_t *p, fvec_t * ibuf, fvec_t *obuf);
     55typedef smpl_t (*aubio_pitch_conv_t)
    5656  (smpl_t value, uint_t srate, uint_t bufsize);
    5757
    58 void aubio_pitchdetection_slideblock(aubio_pitchdetection_t *p, fvec_t *ibuf);
    59 
    60 void aubio_pitchdetection_mcomb   (aubio_pitchdetection_t *p, fvec_t *ibuf, fvec_t *obuf);
    61 void aubio_pitchdetection_yin     (aubio_pitchdetection_t *p, fvec_t *ibuf, fvec_t *obuf);
    62 void aubio_pitchdetection_schmitt (aubio_pitchdetection_t *p, fvec_t *ibuf, fvec_t *obuf);
    63 void aubio_pitchdetection_fcomb   (aubio_pitchdetection_t *p, fvec_t *ibuf, fvec_t *obuf);
    64 void aubio_pitchdetection_yinfft  (aubio_pitchdetection_t *p, fvec_t *ibuf, fvec_t *obuf);
     58void aubio_pitch_slideblock(aubio_pitch_t *p, fvec_t *ibuf);
     59
     60void aubio_pitch_do_mcomb   (aubio_pitch_t *p, fvec_t *ibuf, fvec_t *obuf);
     61void aubio_pitch_do_yin     (aubio_pitch_t *p, fvec_t *ibuf, fvec_t *obuf);
     62void aubio_pitch_do_schmitt (aubio_pitch_t *p, fvec_t *ibuf, fvec_t *obuf);
     63void aubio_pitch_do_fcomb   (aubio_pitch_t *p, fvec_t *ibuf, fvec_t *obuf);
     64void aubio_pitch_do_yinfft  (aubio_pitch_t *p, fvec_t *ibuf, fvec_t *obuf);
    6565
    6666/** generic pitch detection structure */
    67 struct _aubio_pitchdetection_t {
    68   aubio_pitchdetection_type type; /**< pitch detection mode */
    69   aubio_pitchdetection_mode mode; /**< pitch detection output mode */
     67struct _aubio_pitch_t {
     68  aubio_pitch_type type; /**< pitch detection mode */
     69  aubio_pitch_mode mode; /**< pitch detection output mode */
    7070  uint_t srate;                   /**< samplerate */
    7171  uint_t bufsize;                 /**< buffer size */
     
    7979  cvec_t * fftgrain;              /**< spectral frame for mcomb */
    8080  fvec_t * buf;                   /**< temporary buffer for yin */
    81   aubio_pitchdetection_func_t callback; /**< pointer to current pitch detection method */
    82   aubio_pitchdetection_conv_t freqconv; /**< pointer to current pitch conversion method */
     81  aubio_pitch_func_t callback; /**< pointer to current pitch detection method */
     82  aubio_pitch_conv_t freqconv; /**< pointer to current pitch conversion method */
    8383};
    8484
     
    100100}
    101101
    102 aubio_pitchdetection_t *
    103 new_aubio_pitchdetection (char_t * pitch_mode,
     102aubio_pitch_t *
     103new_aubio_pitch (char_t * pitch_mode,
    104104    uint_t bufsize, uint_t hopsize, uint_t channels, uint_t samplerate)
    105105{
    106   aubio_pitchdetection_t *p = AUBIO_NEW(aubio_pitchdetection_t);
    107   aubio_pitchdetection_type pitch_type;
     106  aubio_pitch_t *p = AUBIO_NEW(aubio_pitch_t);
     107  aubio_pitch_type pitch_type;
    108108  if (strcmp (pitch_mode, "mcomb") == 0)
    109       pitch_type = aubio_pitch_mcomb;
     109      pitch_type = aubio_pitcht_mcomb;
    110110  else if (strcmp (pitch_mode, "yinfft") == 0)
    111       pitch_type = aubio_pitch_yin;
     111      pitch_type = aubio_pitcht_yin;
    112112  else if (strcmp (pitch_mode, "yin") == 0)
    113       pitch_type = aubio_pitch_yin;
     113      pitch_type = aubio_pitcht_yin;
    114114  else if (strcmp (pitch_mode, "schmitt") == 0)
    115       pitch_type = aubio_pitch_schmitt;
     115      pitch_type = aubio_pitcht_schmitt;
    116116  else if (strcmp (pitch_mode, "fcomb") == 0)
    117       pitch_type = aubio_pitch_fcomb;
     117      pitch_type = aubio_pitcht_fcomb;
    118118  else if (strcmp (pitch_mode, "default") == 0)
    119       pitch_type = aubio_pitch_default;
     119      pitch_type = aubio_pitcht_default;
    120120  else {
    121121      AUBIO_ERR ("unknown pitch detection method %s, using default.\n", pitch_mode);
    122       pitch_type = aubio_pitch_default;
     122      pitch_type = aubio_pitcht_default;
    123123      return NULL;
    124124  }
    125125  p->srate = samplerate;
    126126  p->type = pitch_type;
    127   aubio_pitchdetection_set_unit (p, "default");
     127  aubio_pitch_set_unit (p, "default");
    128128  p->bufsize = bufsize;
    129129  switch(p->type) {
    130     case aubio_pitch_yin:
     130    case aubio_pitcht_yin:
    131131      p->buf      = new_fvec(bufsize,channels);
    132132      p->yin      = new_aubio_pitchyin(bufsize);
    133       p->callback = aubio_pitchdetection_yin;
     133      p->callback = aubio_pitch_do_yin;
    134134      aubio_pitchyin_set_tolerance (p->yin, 0.15);
    135135      break;
    136     case aubio_pitch_mcomb:
     136    case aubio_pitcht_mcomb:
    137137      p->pv       = new_aubio_pvoc(bufsize, hopsize, channels);
    138138      p->fftgrain = new_cvec(bufsize, channels);
    139139      p->mcomb    = new_aubio_pitchmcomb(bufsize,hopsize,channels);
    140140      p->filter   = new_aubio_filter_c_weighting (samplerate, channels);
    141       p->callback = aubio_pitchdetection_mcomb;
    142       break;
    143     case aubio_pitch_fcomb:
     141      p->callback = aubio_pitch_do_mcomb;
     142      break;
     143    case aubio_pitcht_fcomb:
    144144      p->buf      = new_fvec(bufsize,channels);
    145145      p->fcomb    = new_aubio_pitchfcomb(bufsize,hopsize,channels);
    146       p->callback = aubio_pitchdetection_fcomb;
    147       break;
    148     case aubio_pitch_schmitt:
     146      p->callback = aubio_pitch_do_fcomb;
     147      break;
     148    case aubio_pitcht_schmitt:
    149149      p->buf      = new_fvec(bufsize,channels);
    150150      p->schmitt  = new_aubio_pitchschmitt(bufsize);
    151       p->callback = aubio_pitchdetection_schmitt;
    152       break;
    153     case aubio_pitch_yinfft:
     151      p->callback = aubio_pitch_do_schmitt;
     152      break;
     153    case aubio_pitcht_yinfft:
    154154      p->buf      = new_fvec(bufsize,channels);
    155155      p->yinfft   = new_aubio_pitchyinfft(bufsize);
    156       p->callback = aubio_pitchdetection_yinfft;
     156      p->callback = aubio_pitch_do_yinfft;
    157157      aubio_pitchyinfft_set_tolerance (p->yinfft, 0.85);
    158158      break;
     
    163163}
    164164
    165 void del_aubio_pitchdetection(aubio_pitchdetection_t * p) {
     165void del_aubio_pitch(aubio_pitch_t * p) {
    166166  switch(p->type) {
    167     case aubio_pitch_yin:
     167    case aubio_pitcht_yin:
    168168      del_fvec(p->buf);
    169169      del_aubio_pitchyin(p->yin);
    170170      break;
    171     case aubio_pitch_mcomb:
     171    case aubio_pitcht_mcomb:
    172172      del_aubio_pvoc(p->pv);
    173173      del_cvec(p->fftgrain);
     
    175175      del_aubio_pitchmcomb(p->mcomb);
    176176      break;
    177     case aubio_pitch_schmitt:
     177    case aubio_pitcht_schmitt:
    178178      del_fvec(p->buf);
    179179      del_aubio_pitchschmitt(p->schmitt);
    180180      break;
    181     case aubio_pitch_fcomb:
     181    case aubio_pitcht_fcomb:
    182182      del_fvec(p->buf);
    183183      del_aubio_pitchfcomb(p->fcomb);
    184184      break;
    185     case aubio_pitch_yinfft:
     185    case aubio_pitcht_yinfft:
    186186      del_fvec(p->buf);
    187187      del_aubio_pitchyinfft(p->yinfft);
     
    193193}
    194194
    195 void aubio_pitchdetection_slideblock(aubio_pitchdetection_t *p, fvec_t *ibuf){
     195void aubio_pitch_slideblock(aubio_pitch_t *p, fvec_t *ibuf){
    196196  uint_t i,j = 0, overlap_size = 0;
    197197  overlap_size = p->buf->length-ibuf->length;
     
    208208}
    209209
    210 uint_t aubio_pitchdetection_set_unit (aubio_pitchdetection_t *p, char_t * pitch_unit) {
    211   aubio_pitchdetection_mode pitch_mode;
     210uint_t aubio_pitch_set_unit (aubio_pitch_t *p, char_t * pitch_unit) {
     211  aubio_pitch_mode pitch_mode;
    212212  if (strcmp (pitch_unit, "freq") == 0)
    213213      pitch_mode = aubio_pitchm_freq;
     
    245245}
    246246
    247 uint_t aubio_pitchdetection_set_tolerance(aubio_pitchdetection_t *p, smpl_t tol) {
     247uint_t aubio_pitch_set_tolerance(aubio_pitch_t *p, smpl_t tol) {
    248248  switch(p->type) {
    249     case aubio_pitch_yin:
     249    case aubio_pitcht_yin:
    250250      aubio_pitchyin_set_tolerance (p->yin, tol);
    251251      break;
    252     case aubio_pitch_yinfft:
     252    case aubio_pitcht_yinfft:
    253253      aubio_pitchyinfft_set_tolerance (p->yinfft, tol);
    254254      break;
     
    259259}
    260260
    261 void aubio_pitchdetection_do (aubio_pitchdetection_t *p, fvec_t * ibuf, fvec_t *obuf) {
     261void aubio_pitch_do (aubio_pitch_t *p, fvec_t * ibuf, fvec_t *obuf) {
    262262  uint_t i;
    263263  p->callback(p, ibuf, obuf);
     
    267267}
    268268
    269 void aubio_pitchdetection_mcomb(aubio_pitchdetection_t *p, fvec_t *ibuf, fvec_t * obuf) {
     269void aubio_pitch_do_mcomb(aubio_pitch_t *p, fvec_t *ibuf, fvec_t * obuf) {
    270270  uint_t i;
    271271  aubio_filter_do(p->filter,ibuf);
     
    277277}
    278278
    279 void aubio_pitchdetection_yin(aubio_pitchdetection_t *p, fvec_t *ibuf, fvec_t * obuf) {
     279void aubio_pitch_do_yin(aubio_pitch_t *p, fvec_t *ibuf, fvec_t * obuf) {
    280280  smpl_t pitch = 0.;
    281281  uint_t i;
    282   aubio_pitchdetection_slideblock(p,ibuf);
     282  aubio_pitch_slideblock(p,ibuf);
    283283  aubio_pitchyin_do(p->yin,p->buf, obuf);
    284284  for (i = 0; i < obuf->channels; i++) {
     
    294294
    295295
    296 void aubio_pitchdetection_yinfft(aubio_pitchdetection_t *p, fvec_t *ibuf, fvec_t * obuf){
     296void aubio_pitch_do_yinfft(aubio_pitch_t *p, fvec_t *ibuf, fvec_t * obuf){
    297297  smpl_t pitch = 0.;
    298298  uint_t i;
    299   aubio_pitchdetection_slideblock(p,ibuf);
     299  aubio_pitch_slideblock(p,ibuf);
    300300  aubio_pitchyinfft_do(p->yinfft,p->buf,obuf);
    301301  for (i = 0; i < obuf->channels; i++) {
     
    310310}
    311311
    312 void aubio_pitchdetection_fcomb(aubio_pitchdetection_t *p, fvec_t *ibuf, fvec_t * out){
    313   uint_t i;
    314   aubio_pitchdetection_slideblock(p,ibuf);
     312void aubio_pitch_do_fcomb(aubio_pitch_t *p, fvec_t *ibuf, fvec_t * out){
     313  uint_t i;
     314  aubio_pitch_slideblock(p,ibuf);
    315315  aubio_pitchfcomb_do(p->fcomb,p->buf, out);
    316316  for (i = 0; i < out->channels; i++) {
     
    319319}
    320320
    321 void aubio_pitchdetection_schmitt(aubio_pitchdetection_t *p, fvec_t *ibuf, fvec_t *out){
     321void aubio_pitch_do_schmitt(aubio_pitch_t *p, fvec_t *ibuf, fvec_t *out){
    322322  smpl_t period, pitch = 0.;
    323323  uint_t i;
    324   aubio_pitchdetection_slideblock(p,ibuf);
     324  aubio_pitch_slideblock(p,ibuf);
    325325  aubio_pitchschmitt_do(p->schmitt,p->buf, out);
    326326  for (i = 0; i < out->channels; i++) {
  • src/pitch/pitch.h

    r9f07d52 rca1abdd  
    1717   */
    1818
    19 #ifndef PITCHAUTOTCORR_H
    20 #define PITCHAUTOTCORR_H
     19#ifndef PITCH_H
     20#define PITCH_H
    2121
    2222#ifdef __cplusplus
     
    3434
    3535/** pitch detection object */
    36 typedef struct _aubio_pitchdetection_t aubio_pitchdetection_t;
     36typedef struct _aubio_pitch_t aubio_pitch_t;
    3737
    3838/** execute pitch detection on an input signal frame
    3939
    40   \param o pitch detection object as returned by new_aubio_pitchdetection()
     40  \param o pitch detection object as returned by new_aubio_pitch()
    4141  \param in input signal of size [hopsize x channels]
    4242  \param out output pitch candidates of size [1 x channes]
    4343
    4444*/
    45 void aubio_pitchdetection_do (aubio_pitchdetection_t * o, fvec_t * in,
     45void aubio_pitch_do (aubio_pitch_t * o, fvec_t * in,
    4646    fvec_t * out);
    4747
    4848/** change yin or yinfft tolerance threshold
    4949
    50   \param o pitch detection object as returned by new_aubio_pitchdetection()
     50  \param o pitch detection object as returned by new_aubio_pitch()
    5151  \param tol tolerance default is 0.15 for yin and 0.85 for yinfft
    5252
    5353*/
    54 uint_t aubio_pitchdetection_set_tolerance (aubio_pitchdetection_t * o,
     54uint_t aubio_pitch_set_tolerance (aubio_pitch_t * o,
    5555    smpl_t tol);
    5656
    5757/** deletion of the pitch detection object
    5858
    59   \param o pitch detection object as returned by new_aubio_pitchdetection()
     59  \param o pitch detection object as returned by new_aubio_pitch()
    6060
    6161*/
    62 void del_aubio_pitchdetection (aubio_pitchdetection_t * o);
     62void del_aubio_pitch (aubio_pitch_t * o);
    6363
    6464/** creation of the pitch detection object
     
    7171
    7272*/
    73 aubio_pitchdetection_t *new_aubio_pitchdetection (char_t * mode,
     73aubio_pitch_t * new_aubio_pitch (char_t * mode,
    7474    uint_t bufsize, uint_t hopsize, uint_t channels, uint_t samplerate);
    7575
    7676/** set the output unit of the pitch detection object
    7777
    78   \param o pitch detection object as returned by new_aubio_pitchdetection()
     78  \param o pitch detection object as returned by new_aubio_pitch()
    7979  \param mode set pitch units for output
    8080
    8181*/
    82 uint_t aubio_pitchdetection_set_unit (aubio_pitchdetection_t * o,
     82uint_t aubio_pitch_set_unit (aubio_pitch_t * o,
    8383    char_t * mode);
    8484
     
    8787#endif
    8888
    89 #endif /*PITCHDETECTION_H*/
     89#endif /*PITCH_H*/
  • swig/aubio.i

    r9f07d52 rca1abdd  
    171171
    172172/* pitch detection */
    173 aubio_pitchdetection_t *new_aubio_pitchdetection (char *pitch_mode,
     173aubio_pitch_t *new_aubio_pitch (char *pitch_mode,
    174174    uint_t bufsize, uint_t hopsize, uint_t channels, uint_t samplerate);
    175 void aubio_pitchdetection_do (aubio_pitchdetection_t * p, fvec_t * ibuf, fvec_t * obuf);
    176 uint_t aubio_pitchdetection_set_tolerance(aubio_pitchdetection_t *p, smpl_t thres);
    177 uint_t aubio_pitchdetection_set_unit(aubio_pitchdetection_t *p, char * pitch_unit);
    178 void del_aubio_pitchdetection(aubio_pitchdetection_t * p);
     175void aubio_pitch_do (aubio_pitch_t * p, fvec_t * ibuf, fvec_t * obuf);
     176uint_t aubio_pitch_set_tolerance(aubio_pitch_t *p, smpl_t thres);
     177uint_t aubio_pitch_set_unit(aubio_pitch_t *p, char * pitch_unit);
     178void del_aubio_pitch(aubio_pitch_t * p);
    179179
    180180/* pitch mcomb */
  • tests/python/src/pitch/pitchdetection.py

    r9f07d52 rca1abdd  
    77samplerate = 44100.
    88
    9 class pitchdetection_test_case(unittest.TestCase):
     9class pitch_test_case(unittest.TestCase):
    1010
    1111  def setUp(self, type = aubio_pitch_yinfft, mode = aubio_pitchm_freq):
     
    1515      mode = aubio_pitchm_freq):
    1616    self.type = type
    17     self.o = new_aubio_pitchdetection(buf_size, hop_size,
     17    self.o = new_aubio_pitch(buf_size, hop_size,
    1818        channels, int(samplerate), type, mode)
    1919
    2020  def tearDown(self):
    21     del_aubio_pitchdetection(self.o)
     21    del_aubio_pitch(self.o)
    2222
    23   def test_pitchdetection(self):
    24     """ create and delete pitchdetection """
     23  def test_pitch(self):
     24    """ create and delete pitch """
    2525    pass
    2626
    27   def test_pitchdetection_run_zeroes(self):
    28     """ run pitchdetection on an empty buffer """
     27  def test_pitch_run_zeroes(self):
     28    """ run pitch on an empty buffer """
    2929    vec = new_fvec(buf_size, channels)
    3030    out = new_fvec(1, channels)
    3131    for i in range(100):
    32       aubio_pitchdetection_do(self.o,vec, out)
     32      aubio_pitch_do(self.o,vec, out)
    3333      self.assertEqual(fvec_read_sample(out, 0, 0),0.)
    3434    del vec
    3535
    36   def test_pitchdetection_run_4_impulses(self):
    37     """ run pitchdetection on a train of 4 impulses """
     36  def test_pitch_run_4_impulses(self):
     37    """ run pitch on a train of 4 impulses """
    3838    vec = new_fvec(buf_size, channels)
    3939    out = new_fvec(1, channels)
     
    4444    frequency = samplerate/2*4/buf_size
    4545    for i in range(100):
    46       aubio_pitchdetection_do(self.o,vec, out)
     46      aubio_pitch_do(self.o,vec, out)
    4747      self.assertEqual(fvec_read_sample(out, 0, 0),frequency)
    4848    del vec
    4949
    50   def test_pitchdetection_run_4_positive_impulses(self):
    51     """ run pitchdetection on a train of 4 positive impulses of arbitrary size """
     50  def test_pitch_run_4_positive_impulses(self):
     51    """ run pitch on a train of 4 positive impulses of arbitrary size """
    5252    vec = new_fvec(buf_size, channels)
    5353    out = new_fvec(1, channels)
     
    5858      fvec_write_sample(vec, 2.-.01*i,0,  buf_size/2)
    5959      fvec_write_sample(vec, 2.-.01*i,0,3*buf_size/4)
    60       aubio_pitchdetection_do(self.o,vec, out)
     60      aubio_pitch_do(self.o,vec, out)
    6161      self.assertAlmostEqual(fvec_read_sample(out, 0, 0),frequency,1)
    6262    del vec
    6363
    64   def test_pitchdetection_run_4_negative_impulses(self):
    65     """ run pitchdetection on a train of 4 negative impulses of arbitrary size """
     64  def test_pitch_run_4_negative_impulses(self):
     65    """ run pitch on a train of 4 negative impulses of arbitrary size """
    6666    vec = new_fvec(buf_size, channels)
    6767    out = new_fvec(1, channels)
     
    7272      fvec_write_sample(vec,-.01*i,0,  buf_size/2)
    7373      fvec_write_sample(vec,-.01*i,0,3*buf_size/4)
    74       aubio_pitchdetection_do(self.o,vec, out)
     74      aubio_pitch_do(self.o,vec, out)
    7575      self.assertAlmostEqual(fvec_read_sample(out, 0, 0),frequency,1)
    7676    del vec
    7777
    78   def test_pitchdetection_run_8_impulses(self):
    79     """ run pitchdetection on a train of 8 impulses """
     78  def test_pitch_run_8_impulses(self):
     79    """ run pitch on a train of 8 impulses """
    8080    vec = new_fvec(buf_size, channels)
    8181    out = new_fvec(1, channels)
     
    8989    fvec_write_sample(vec,-1.,0,7*buf_size/8)
    9090    for i in range(100):
    91       aubio_pitchdetection_do(self.o,vec, out)
     91      aubio_pitch_do(self.o,vec, out)
    9292      self.assertAlmostEqual(fvec_read_sample(out, 0, 0),
    9393        samplerate/2/buf_size*8, 1)
     
    9595
    9696"""
    97 class pitchdetection_yin_test_case(pitchdetection_test_case):
     97class pitch_yin_test_case(pitchdetection_test_case):
    9898  def setUp(self, type = aubio_pitch_yin):
    9999    self.create(type=type)
    100100
    101 class pitchdetection_fcomb_test_case(pitchdetection_test_case):
     101class pitch_fcomb_test_case(pitchdetection_test_case):
    102102  def setUp(self, type = aubio_pitch_fcomb):
    103103    self.create(type=type)
    104104
    105 class pitchdetection_mcomb_test_case(pitchdetection_test_case):
     105class pitch_mcomb_test_case(pitchdetection_test_case):
    106106  def setUp(self, type = aubio_pitch_mcomb):
    107107    self.create(type=type)
    108108
    109 class pitchdetection_schmitt_test_case(pitchdetection_test_case):
     109class pitch_schmitt_test_case(pitchdetection_test_case):
    110110  def setUp(self, type = aubio_pitch_schmitt):
    111111    self.create(type=type)
  • tests/src/Makefile.am

    r9f07d52 rca1abdd  
    2727        test-pitchfcomb \
    2828        test-pitchmcomb \
    29         test-pitchdetection \
     29        test-pitch \
    3030        test-beattracking \
    3131        test-onset \
  • tests/src/test-pitchdetection.c

    r9f07d52 rca1abdd  
    1111  fvec_t *in = new_fvec (hop_s, channels);      /* input buffer */
    1212  fvec_t *out = new_fvec (1, channels); /* input buffer */
    13   aubio_pitchdetection_t *o =
    14       new_aubio_pitchdetection ("default", win_s, hop_s, channels, samplerate);
     13  aubio_pitch_t *o =
     14      new_aubio_pitch ("default", win_s, hop_s, channels, samplerate);
    1515  uint_t i = 0;
    1616
    1717  while (i < 100) {
    18     aubio_pitchdetection_do (o, in, out);
     18    aubio_pitch_do (o, in, out);
    1919    i++;
    2020  };
    2121
    22   del_aubio_pitchdetection (o);
     22  del_aubio_pitch (o);
    2323  del_fvec (in);
    2424  aubio_cleanup ();
Note: See TracChangeset for help on using the changeset viewer.