Ignore:
Timestamp:
Dec 5, 2018, 10:34:39 PM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/cnn, feature/crepe, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
Children:
283a619a
Parents:
5b46bc3 (diff), f19db54 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into feature/pitchshift

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/spectral/filterbank.c

    r5b46bc3 r633400d  
    2424#include "fmat.h"
    2525#include "cvec.h"
     26#include "vecutils.h"
    2627#include "spectral/filterbank.h"
    2728#include "mathutils.h"
     
    3334  uint_t n_filters;
    3435  fmat_t *filters;
     36  smpl_t norm;
     37  smpl_t power;
    3538};
    3639
     
    4043  /* allocate space for filterbank object */
    4144  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  }
    4254  fb->win_s = win_s;
    4355  fb->n_filters = n_filters;
     
    4658  fb->filters = new_fmat (n_filters, win_s / 2 + 1);
    4759
     60  fb->norm = 1;
     61
     62  fb->power = 1;
     63
    4864  return fb;
     65fail:
     66  AUBIO_FREE (fb);
     67  return NULL;
    4968}
    5069
     
    6887  tmp.data = in->norm;
    6988
     89  if (f->power != 1.) fvec_pow(&tmp, f->power);
     90
    7091  fmat_vecmul(f->filters, &tmp, out);
    7192
     
    85106  return 0;
    86107}
     108
     109uint_t
     110aubio_filterbank_set_norm (aubio_filterbank_t *f, smpl_t norm)
     111{
     112  if (norm != 0 && norm != 1) return AUBIO_FAIL;
     113  f->norm = norm;
     114  return AUBIO_OK;
     115}
     116
     117smpl_t
     118aubio_filterbank_get_norm (aubio_filterbank_t *f)
     119{
     120  return f->norm;
     121}
     122
     123uint_t
     124aubio_filterbank_set_power (aubio_filterbank_t *f, smpl_t power)
     125{
     126  f->power = power;
     127  return AUBIO_OK;
     128}
     129
     130smpl_t
     131aubio_filterbank_get_power (aubio_filterbank_t *f)
     132{
     133  return f->power;
     134}
Note: See TracChangeset for help on using the changeset viewer.