Changeset 3f99693 for src


Ignore:
Timestamp:
Oct 19, 2009, 3:00:32 PM (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:
615ac7d
Parents:
b849106
Message:

src/temporal/filter.c: reset filter memory in filtfilt

Location:
src/temporal
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/temporal/filter.c

    rb849106 r3f99693  
    8080}
    8181
    82 /* 
    83  *
    84  * despite mirroring, end effects destroy both phse and amplitude. the longer
    85  * the buffer, the less affected they are.
    86  *
    87  * replacing with zeros clicks.
    88  *
    89  * seems broken for order > 4 (see biquad_do_filtfilt for audible one)
    90  */
     82/* The rough way: reset memory of filter between each run to avoid end effects. */
    9183void aubio_filter_do_filtfilt(aubio_filter_t * f, fvec_t * in, fvec_t * tmp) {
    9284  uint_t j,i=0;
    9385  uint_t length = in->length;
    94   //uint_t order = f->order;
    95   //lsmp_t mir;
    96   /* mirroring */
    97   //mir = 2*in->data[i][0];
    98   //for (j=1;j<order;j++)
    99   //f->x[j] = 0.;//mir - in->data[i][order-j];
    10086  /* apply filtering */
    10187  aubio_filter_do(f,in);
    102   /* invert */
     88  aubio_filter_do_reset(f);
     89  /* mirror */
    10390  for (j = 0; j < length; j++)
    10491    tmp->data[i][length-j-1] = in->data[i][j];
    105   /* mirror inverted */
    106   //mir = 2*tmp->data[i][0];
    107   //for (j=1;j<order;j++)
    108   //f->x[j] = 0.;//mir - tmp->data[i][order-j];
    109   /* apply filtering on inverted */
     92  /* apply filtering on mirrored */
    11093  aubio_filter_do(f,tmp);
     94  aubio_filter_do_reset(f);
    11195  /* invert back */
    11296  for (j = 0; j < length; j++)
     
    145129}
    146130
     131void
     132aubio_filter_do_reset (aubio_filter_t * f)
     133{
     134  lvec_zeros(f->x);
     135  lvec_zeros(f->y);
     136}
     137
    147138aubio_filter_t *
    148139new_aubio_filter (uint_t order, uint_t channels)
  • src/temporal/filter.h

    rb849106 r3f99693  
    141141uint_t aubio_filter_set_samplerate (aubio_filter_t * f, uint_t samplerate);
    142142
     143/** reset filter memory */
     144void aubio_filter_do_reset (aubio_filter_t * f);
     145
    143146/** create new filter object
    144147
Note: See TracChangeset for help on using the changeset viewer.