Changeset ca1abdd for src


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

Location:
src
Files:
2 edited
2 moved

Legend:

Unmodified
Added
Removed
  • 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*/
Note: See TracChangeset for help on using the changeset viewer.