Changeset 0e30a12


Ignore:
Timestamp:
Nov 17, 2018, 12:18:11 PM (5 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
Children:
6b46a4e
Parents:
1d51820
Message:

[filterbank] add norm and power parameters

Location:
src/spectral
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/spectral/filterbank.c

    r1d51820 r0e30a12  
    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
     
    4548  /* allocate filter tables, a matrix of length win_s and of height n_filters */
    4649  fb->filters = new_fmat (n_filters, win_s / 2 + 1);
     50
     51  fb->norm = 1;
     52
     53  fb->power = 1;
    4754
    4855  return fb;
     
    6875  tmp.data = in->norm;
    6976
     77  if (f->power != 1.) fvec_pow(&tmp, f->power);
     78
    7079  fmat_vecmul(f->filters, &tmp, out);
    7180
     
    8594  return 0;
    8695}
     96
     97uint_t
     98aubio_filterbank_set_norm (aubio_filterbank_t *f, smpl_t norm)
     99{
     100  if (norm != 0 && norm != 1) return AUBIO_FAIL;
     101  f->norm = norm;
     102  return AUBIO_OK;
     103}
     104
     105smpl_t
     106aubio_filterbank_get_norm (aubio_filterbank_t *f)
     107{
     108  return f->norm;
     109}
     110
     111uint_t
     112aubio_filterbank_set_power (aubio_filterbank_t *f, smpl_t power)
     113{
     114  f->power = power;
     115  return AUBIO_OK;
     116}
     117
     118smpl_t
     119aubio_filterbank_get_power (aubio_filterbank_t *f)
     120{
     121  return f->norm;
     122}
  • src/spectral/filterbank.h

    r1d51820 r0e30a12  
    8484uint_t aubio_filterbank_set_coeffs (aubio_filterbank_t * f, const fmat_t * filters);
    8585
     86uint_t aubio_filterbank_set_norm (aubio_filterbank_t *f, smpl_t norm);
     87
     88smpl_t aubio_filterbank_get_norm (aubio_filterbank_t *f);
     89
     90uint_t aubio_filterbank_set_power (aubio_filterbank_t *f, smpl_t power);
     91
     92smpl_t aubio_filterbank_get_power (aubio_filterbank_t *f);
     93
    8694#ifdef __cplusplus
    8795}
Note: See TracChangeset for help on using the changeset viewer.