Changes in / [ce323e4:0f5f40b]


Ignore:
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • VERSION

    rce323e4 r0f5f40b  
    11AUBIO_MAJOR_VERSION=0
    22AUBIO_MINOR_VERSION=4
    3 AUBIO_PATCH_VERSION=9
    4 AUBIO_VERSION_STATUS='~alpha'
     3AUBIO_PATCH_VERSION=8
     4AUBIO_VERSION_STATUS=''
    55LIBAUBIO_LT_CUR=5
    66LIBAUBIO_LT_REV=4
  • src/spectral/filterbank.c

    rce323e4 r0f5f40b  
    4343  /* allocate space for filterbank object */
    4444  aubio_filterbank_t *fb = AUBIO_NEW (aubio_filterbank_t);
    45 
    46   if ((sint_t)n_filters <= 0) {
    47     AUBIO_ERR("filterbank: n_filters should be > 0, got %d\n", n_filters);
    48     goto fail;
    49   }
    50   if ((sint_t)win_s <= 0) {
    51     AUBIO_ERR("filterbank: win_s should be > 0, got %d\n", win_s);
    52     goto fail;
    53   }
    5445  fb->win_s = win_s;
    5546  fb->n_filters = n_filters;
     
    6354
    6455  return fb;
    65 fail:
    66   AUBIO_FREE (fb);
    67   return NULL;
    6856}
    6957
  • src/spectral/specdesc.c

    rce323e4 r0f5f40b  
    297297      onset_type = aubio_onset_default;
    298298  else {
    299       AUBIO_ERR("specdesc: unknown spectral descriptor type '%s'\n",
    300           onset_mode);
     299      AUBIO_ERR("unknown spectral descriptor type %s\n", onset_mode);
    301300      AUBIO_FREE(o);
    302301      return NULL;
  • src/tempo/tempo.c

    rce323e4 r0f5f40b  
    129129
    130130uint_t aubio_tempo_set_delay_ms(aubio_tempo_t * o, smpl_t delay) {
    131   return aubio_tempo_set_delay_s(o, delay / 1000.);
     131  o->delay = 1000. * delay * o->samplerate;
     132  return AUBIO_OK;
    132133}
    133134
     
    141142
    142143smpl_t aubio_tempo_get_delay_ms(aubio_tempo_t * o) {
    143   return aubio_tempo_get_delay_s(o) * 1000.;
     144  return o->delay / (smpl_t)(o->samplerate) / 1000.;
    144145}
    145146
     
    168169{
    169170  aubio_tempo_t * o = AUBIO_NEW(aubio_tempo_t);
    170   char_t specdesc_func[PATH_MAX];
     171  char_t specdesc_func[20];
    171172  o->samplerate = samplerate;
    172173  // check parameters are valid
     
    203204  aubio_peakpicker_set_threshold (o->pp, o->threshold);
    204205  if ( strcmp(tempo_mode, "default") == 0 ) {
    205     strncpy(specdesc_func, "specflux", PATH_MAX - 1);
     206    strcpy(specdesc_func, "specflux");
    206207  } else {
    207     strncpy(specdesc_func, tempo_mode, PATH_MAX - 1);
    208     specdesc_func[PATH_MAX - 1] = '\0';
     208    strcpy(specdesc_func, tempo_mode);
    209209  }
    210210  o->od       = new_aubio_specdesc(specdesc_func,buf_size);
     
    216216    onset2 = new_fvec(1);
    217217  }*/
    218   if (!o->dfframe || !o->fftgrain || !o->out || !o->pv ||
    219       !o->pp || !o->od || !o->of || !o->bt || !o->onset) {
    220     AUBIO_ERR("tempo: failed creating tempo object\n");
    221     goto beach;
    222   }
    223218  o->last_tatum = 0;
    224219  o->tatum_signature = 4;
     
    226221
    227222beach:
    228   del_aubio_tempo(o);
     223  AUBIO_FREE(o);
    229224  return NULL;
    230225}
     
    283278void del_aubio_tempo (aubio_tempo_t *o)
    284279{
    285   if (o->od)
    286     del_aubio_specdesc(o->od);
    287   if (o->bt)
    288     del_aubio_beattracking(o->bt);
    289   if (o->pp)
    290     del_aubio_peakpicker(o->pp);
    291   if (o->pv)
    292     del_aubio_pvoc(o->pv);
    293   if (o->out)
    294     del_fvec(o->out);
    295   if (o->of)
    296     del_fvec(o->of);
    297   if (o->fftgrain)
    298     del_cvec(o->fftgrain);
    299   if (o->dfframe)
    300     del_fvec(o->dfframe);
    301   if (o->onset)
    302     del_fvec(o->onset);
     280  del_aubio_specdesc(o->od);
     281  del_aubio_beattracking(o->bt);
     282  del_aubio_peakpicker(o->pp);
     283  del_aubio_pvoc(o->pv);
     284  del_fvec(o->out);
     285  del_fvec(o->of);
     286  del_cvec(o->fftgrain);
     287  del_fvec(o->dfframe);
     288  del_fvec(o->onset);
    303289  AUBIO_FREE(o);
    304 }
     290  return;
     291}
  • tests/src/spectral/test-filterbank.c

    rce323e4 r0f5f40b  
    88  cvec_t *in_spec = new_cvec (win_s); // input vector of samples
    99  fvec_t *out_filters = new_fvec (n_filters); // per-band outputs
    10 
    11   if (new_aubio_filterbank(0, win_s)) return 1;
    12   if (new_aubio_filterbank(n_filters, 0)) return 1;
    1310
    1411  // create filterbank object
  • tests/src/tempo/test-tempo.c

    rce323e4 r0f5f40b  
    11#include <aubio.h>
    22#include "utils_tests.h"
    3 
    4 int test_wrong_params(void);
    53
    64int main (int argc, char **argv)
     
    97  if (argc < 2) {
    108    err = 2;
    11     PRINT_WRN("no arguments, running tests\n");
    12     if (test_wrong_params() != 0) {
    13       PRINT_ERR("tests failed!\n");
    14       err = 1;
    15     } else {
    16       err = 0;
    17     }
    18     PRINT_MSG("usage: %s <source_path> [samplerate] [win_size] [hop_size]\n",
    19         argv[0]);
     9    PRINT_ERR("not enough arguments\n");
     10    PRINT_MSG("read a wave file as a mono vector\n");
     11    PRINT_MSG("usage: %s <source_path> [samplerate] [win_size] [hop_size]\n", argv[0]);
    2012    return err;
    2113  }
     
    2921
    3022  char_t *source_path = argv[1];
    31   aubio_source_t * source = new_aubio_source(source_path, samplerate,
    32       hop_size);
     23  aubio_source_t * source = new_aubio_source(source_path, samplerate, hop_size);
    3324  if (!source) { err = 1; goto beach; }
    3425
     
    4031
    4132  // create tempo object
    42   aubio_tempo_t * o = new_aubio_tempo("default", win_size, hop_size,
    43       samplerate);
    44 
    45   if (!o) { err = 1; goto beach_tempo; }
     33  aubio_tempo_t * o = new_aubio_tempo("default", win_size, hop_size, samplerate);
    4634
    4735  do {
     
    5240    // do something with the beats
    5341    if (out->data[0] != 0) {
    54       PRINT_MSG("beat at %.3fms, %.3fs, frame %d, %.2f bpm "
    55           "with confidence %.2f\n",
     42      PRINT_MSG("beat at %.3fms, %.3fs, frame %d, %.2fbpm with confidence %.2f\n",
    5643          aubio_tempo_get_last_ms(o), aubio_tempo_get_last_s(o),
    57           aubio_tempo_get_last(o), aubio_tempo_get_bpm(o),
    58           aubio_tempo_get_confidence(o));
     44          aubio_tempo_get_last(o), aubio_tempo_get_bpm(o), aubio_tempo_get_confidence(o));
    5945    }
    6046    n_frames += read;
     
    6854  // clean up memory
    6955  del_aubio_tempo(o);
    70 beach_tempo:
    7156  del_fvec(in);
    7257  del_fvec(out);
     
    7762  return err;
    7863}
    79 
    80 int test_wrong_params(void)
    81 {
    82   uint_t win_size = 1024;
    83   uint_t hop_size = 256;
    84   uint_t samplerate = 44100;
    85   aubio_tempo_t *t;
    86   fvec_t* in, *out;
    87   uint_t i;
    88 
    89   // test wrong method fails
    90   if (new_aubio_tempo("unexisting_method", win_size, hop_size, samplerate))
    91     return 1;
    92 
    93   // test hop > win fails
    94   if (new_aubio_tempo("default", hop_size, win_size, samplerate))
    95     return 1;
    96 
    97   // test null hop_size fails
    98   if (new_aubio_tempo("default", win_size, 0, samplerate))
    99     return 1;
    100 
    101   // test 1 buf_size fails
    102   if (new_aubio_tempo("default", 1, 1, samplerate))
    103     return 1;
    104 
    105   // test null samplerate fails
    106   if (new_aubio_tempo("default", win_size, hop_size, 0))
    107     return 1;
    108 
    109   // test short sizes workaround
    110   t = new_aubio_tempo("default", 2048, 2048, 500);
    111   if (!t)
    112     return 1;
    113 
    114   del_aubio_tempo(t);
    115 
    116   t = new_aubio_tempo("default", win_size, hop_size, samplerate);
    117   if (!t)
    118     return 1;
    119 
    120   in = new_fvec(hop_size);
    121   out = new_fvec(1);
    122 
    123   // up to step = (next_power_of_two(5.8 * samplerate / hop_size ) / 4 )
    124   for (i = 0; i < 256 + 1; i++)
    125   {
    126     aubio_tempo_do(t,in,out);
    127     PRINT_MSG("beat at %.3fms, %.3fs, frame %d, %.2f bpm "
    128         "with confidence %.2f, was tatum %d\n",
    129         aubio_tempo_get_last_ms(t), aubio_tempo_get_last_s(t),
    130         aubio_tempo_get_last(t), aubio_tempo_get_bpm(t),
    131         aubio_tempo_get_confidence(t), aubio_tempo_was_tatum(t));
    132   }
    133 
    134   del_aubio_tempo(t);
    135   del_fvec(in);
    136   del_fvec(out);
    137 
    138   return 0;
    139 }
Note: See TracChangeset for help on using the changeset viewer.