Ignore:
Timestamp:
Dec 4, 2009, 1:38:30 AM (14 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:
741bdda
Parents:
0b9a02a
Message:

src/spectral: switch to mono

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/spectral/filterbank.c

    r0b9a02a rd95ff38  
    2222#include "aubio_priv.h"
    2323#include "fvec.h"
     24#include "fmat.h"
    2425#include "cvec.h"
    2526#include "spectral/filterbank.h"
     
    3132  uint_t win_s;
    3233  uint_t n_filters;
    33   fvec_t *filters;
     34  fmat_t *filters;
    3435};
    3536
     
    4243  fb->n_filters = n_filters;
    4344
    44   /* allocate filter tables, an fvec of length win_s and of filter_cnt channel */
    45   fb->filters = new_fvec (win_s / 2 + 1, n_filters);
     45  /* allocate filter tables, a matrix of length win_s and of height n_filters */
     46  fb->filters = new_fmat (win_s / 2 + 1, n_filters);
    4647
    4748  return fb;
     
    5152del_aubio_filterbank (aubio_filterbank_t * fb)
    5253{
    53   del_fvec (fb->filters);
     54  del_fmat (fb->filters);
    5455  AUBIO_FREE (fb);
    5556}
     
    5859aubio_filterbank_do (aubio_filterbank_t * f, cvec_t * in, fvec_t * out)
    5960{
    60   uint_t i, j, fn;
     61  uint_t j, fn;
    6162
    6263  /* apply filter to all input channel, provided out has enough channels */
    63   uint_t max_channels = MIN (in->channels, out->channels);
    6464  uint_t max_filters = MIN (f->n_filters, out->length);
    6565  uint_t max_length = MIN (in->length, f->filters->length);
     
    6868  fvec_zeros (out);
    6969
    70   /* apply filters on all channels */
    71   for (i = 0; i < max_channels; i++) {
     70  /* for each filter */
     71  for (fn = 0; fn < max_filters; fn++) {
    7272
    73     /* for each filter */
    74     for (fn = 0; fn < max_filters; fn++) {
    75 
    76       /* for each sample */
    77       for (j = 0; j < max_length; j++) {
    78         out->data[i][fn] += in->norm[i][j] * f->filters->data[fn][j];
    79       }
     73    /* for each sample */
     74    for (j = 0; j < max_length; j++) {
     75      out->data[fn] += in->norm[j] * f->filters->data[fn][j];
    8076    }
    8177  }
     
    8480}
    8581
    86 fvec_t *
     82fmat_t *
    8783aubio_filterbank_get_coeffs (aubio_filterbank_t * f)
    8884{
     
    9187
    9288uint_t
    93 aubio_filterbank_set_coeffs (aubio_filterbank_t * f, fvec_t * filters)
     89aubio_filterbank_set_coeffs (aubio_filterbank_t * f, fmat_t * filter_coeffs)
    9490{
    95   fvec_copy(filters, f->filters);
     91  fmat_copy(filter_coeffs, f->filters);
    9692  return 0;
    9793}
Note: See TracChangeset for help on using the changeset viewer.