Changeset 741bdda for src/temporal


Ignore:
Timestamp:
Dec 4, 2009, 1:39: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:
d207300
Parents:
d95ff38
Message:

src/temporal: switch to mono

Location:
src/temporal
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • src/temporal/a_weighting.c

    rd95ff38 r741bdda  
    3232  lvec_t *bs = aubio_filter_get_feedforward (f);
    3333  lvec_t *as = aubio_filter_get_feedback (f);
    34   lsmp_t *b = bs->data[0], *a = as->data[0];
     34  lsmp_t *b = bs->data, *a = as->data;
    3535  uint_t order = aubio_filter_get_order (f);
    3636
     
    241241
    242242aubio_filter_t *
    243 new_aubio_filter_a_weighting (uint_t channels, uint_t samplerate)
     243new_aubio_filter_a_weighting (uint_t samplerate)
    244244{
    245   aubio_filter_t *f = new_aubio_filter (7, channels);
     245  aubio_filter_t *f = new_aubio_filter (7);
    246246  aubio_filter_set_a_weighting (f, samplerate);
    247247  return f;
  • src/temporal/a_weighting.h

    rd95ff38 r741bdda  
    6161/** create new A-design filter
    6262
    63   \param channels number of channels to allocate
    6463  \param samplerate sampling frequency of the signal to filter. Should be one of
    6564  8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, and
     
    6968
    7069*/
    71 aubio_filter_t *new_aubio_filter_a_weighting (uint_t channels,
    72     uint_t samplerate);
     70aubio_filter_t *new_aubio_filter_a_weighting (uint_t samplerate);
    7371
    7472/** set feedback and feedforward coefficients of a A-weighting filter
  • src/temporal/biquad.c

    rd95ff38 r741bdda  
    3636    return AUBIO_FAIL;
    3737  }
    38   bs->data[0][0] = b0;
    39   bs->data[0][1] = b1;
    40   bs->data[0][2] = b2;
    41   as->data[0][0] = 1.;
    42   as->data[0][1] = a1;
    43   as->data[0][1] = a2;
     38  bs->data[0] = b0;
     39  bs->data[1] = b1;
     40  bs->data[2] = b2;
     41  as->data[0] = 1.;
     42  as->data[1] = a1;
     43  as->data[1] = a2;
    4444  return AUBIO_OK;
    4545}
    4646
    4747aubio_filter_t *
    48 new_aubio_filter_biquad (lsmp_t b0, lsmp_t b1, lsmp_t b2, lsmp_t a1, lsmp_t a2,
    49     uint_t channels)
     48new_aubio_filter_biquad (lsmp_t b0, lsmp_t b1, lsmp_t b2, lsmp_t a1, lsmp_t a2)
    5049{
    51   aubio_filter_t *f = new_aubio_filter (3, channels);
     50  aubio_filter_t *f = new_aubio_filter (3);
    5251  aubio_filter_set_biquad (f, b0, b1, b2, a1, a2);
    5352  return f;
  • src/temporal/biquad.h

    rd95ff38 r741bdda  
    6262  \param a1 feedback filter coefficient
    6363  \param a2 feedback filter coefficient
    64   \param channels number of channels to allocate
    6564
    6665*/
    6766aubio_filter_t *new_aubio_filter_biquad (lsmp_t b0, lsmp_t b1, lsmp_t b2,
    68     lsmp_t a1, lsmp_t a2, uint_t channels);
     67    lsmp_t a1, lsmp_t a2);
    6968
    7069#ifdef __cplusplus
  • src/temporal/c_weighting.c

    rd95ff38 r741bdda  
    3232  lvec_t *bs = aubio_filter_get_feedforward (f);
    3333  lvec_t *as = aubio_filter_get_feedback (f);
    34   lsmp_t *b = bs->data[0], *a = as->data[0];
     34  lsmp_t *b = bs->data, *a = as->data;
    3535  uint_t order = aubio_filter_get_order (f);
    3636
     
    197197}
    198198
    199 aubio_filter_t * new_aubio_filter_c_weighting (uint_t channels, uint_t samplerate) {
    200   aubio_filter_t * f = new_aubio_filter(5, channels);
     199aubio_filter_t * new_aubio_filter_c_weighting (uint_t samplerate) {
     200  aubio_filter_t * f = new_aubio_filter(5);
    201201  aubio_filter_set_c_weighting (f, samplerate);
    202202  return f;
  • src/temporal/c_weighting.h

    rd95ff38 r741bdda  
    6161/** create new C-design filter
    6262
    63   \param channels number of channels to allocate
    6463  \param samplerate sampling frequency of the signal to filter. Should be one of
    6564  8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, and
     
    6968
    7069*/
    71 aubio_filter_t *new_aubio_filter_c_weighting (uint_t channels,
    72     uint_t samplerate);
     70aubio_filter_t *new_aubio_filter_c_weighting (uint_t samplerate);
    7371
    7472/** set feedback and feedforward coefficients of a C-weighting filter
  • src/temporal/filter.c

    rd95ff38 r741bdda  
    4949aubio_filter_do (aubio_filter_t * f, fvec_t * in)
    5050{
    51   uint_t i, j, l, order = f->order;
    52   lsmp_t *x;
    53   lsmp_t *y;
    54   lsmp_t *a = f->a->data[0];
    55   lsmp_t *b = f->b->data[0];
     51  uint_t j, l, order = f->order;
     52  lsmp_t *x = f->x->data;
     53  lsmp_t *y = f->y->data;
     54  lsmp_t *a = f->a->data;
     55  lsmp_t *b = f->b->data;
    5656
    57   for (i = 0; i < in->channels; i++) {
    58     x = f->x->data[i];
    59     y = f->y->data[i];
    60     for (j = 0; j < in->length; j++) {
    61       /* new input */
    62       x[0] = KILL_DENORMAL (in->data[i][j]);
    63       y[0] = b[0] * x[0];
    64       for (l = 1; l < order; l++) {
    65         y[0] += b[l] * x[l];
    66         y[0] -= a[l] * y[l];
    67       }
    68       /* new output */
    69       in->data[i][j] = y[0];
    70       /* store for next sample */
    71       for (l = order - 1; l > 0; l--) {
    72         x[l] = x[l - 1];
    73         y[l] = y[l - 1];
    74       }
     57  for (j = 0; j < in->length; j++) {
     58    /* new input */
     59    x[0] = KILL_DENORMAL (in->data[j]);
     60    y[0] = b[0] * x[0];
     61    for (l = 1; l < order; l++) {
     62      y[0] += b[l] * x[l];
     63      y[0] -= a[l] * y[l];
    7564    }
    76     /* store for next run */
    77     f->x->data[i] = x;
    78     f->y->data[i] = y;
     65    /* new output */
     66    in->data[j] = y[0];
     67    /* store for next sample */
     68    for (l = order - 1; l > 0; l--) {
     69      x[l] = x[l - 1];
     70      y[l] = y[l - 1];
     71    }
    7972  }
    8073}
     
    8477aubio_filter_do_filtfilt (aubio_filter_t * f, fvec_t * in, fvec_t * tmp)
    8578{
    86   uint_t j, i = 0;
     79  uint_t j;
    8780  uint_t length = in->length;
    8881  /* apply filtering */
     
    9184  /* mirror */
    9285  for (j = 0; j < length; j++)
    93     tmp->data[i][length - j - 1] = in->data[i][j];
     86    tmp->data[length - j - 1] = in->data[j];
    9487  /* apply filtering on mirrored */
    9588  aubio_filter_do (f, tmp);
     
    9790  /* invert back */
    9891  for (j = 0; j < length; j++)
    99     in->data[i][j] = tmp->data[i][length - j - 1];
     92    in->data[j] = tmp->data[length - j - 1];
    10093}
    10194
     
    139132
    140133aubio_filter_t *
    141 new_aubio_filter (uint_t order, uint_t channels)
     134new_aubio_filter (uint_t order)
    142135{
    143136  aubio_filter_t *f = AUBIO_NEW (aubio_filter_t);
    144   f->x = new_lvec (order, channels);
    145   f->y = new_lvec (order, channels);
    146   f->a = new_lvec (order, 1);
    147   f->b = new_lvec (order, 1);
     137  f->x = new_lvec (order);
     138  f->y = new_lvec (order);
     139  f->a = new_lvec (order);
     140  f->b = new_lvec (order);
    148141  /* by default, samplerate is not set */
    149142  f->samplerate = 0;
    150143  f->order = order;
    151144  /* set default to identity */
    152   f->a->data[0][1] = 1.;
     145  f->a->data[1] = 1.;
    153146  return f;
    154147}
  • src/temporal/filter.h

    rd95ff38 r741bdda  
    2626  Digital filter
    2727
    28   This object stores a digital filter of order \f$n\f$ for \f$c\f$ channels.
     28  This object stores a digital filter of order \f$n\f$.
    2929  It contains the following data:
    3030    - \f$ n*1 b_i \f$ feedforward coefficients
     
    151151/** create new filter object
    152152
    153   This function creates a new ::aubio_filter_t object, given an order
    154   and a specific number of channels.
     153  This function creates a new ::aubio_filter_t object, given the order of the
     154  filter.
    155155
    156156  \param order order of the filter (number of coefficients)
    157   \param channels number of channels to allocate
    158157
    159158  \return the newly created filter object
    160159
    161160*/
    162 aubio_filter_t *new_aubio_filter (uint_t order, uint_t channels);
     161aubio_filter_t *new_aubio_filter (uint_t order);
    163162
    164163/** delete a filter object
  • src/temporal/resampler.c

    rd95ff38 r741bdda  
    6161aubio_resampler_do (aubio_resampler_t * s, fvec_t * input, fvec_t * output)
    6262{
    63   uint_t i;
    6463  s->proc->input_frames = input->length;
    6564  s->proc->output_frames = output->length;
    6665  s->proc->src_ratio = (double) s->ratio;
    67   for (i = 0; i < input->channels; i++) {
    68     /* make SRC_PROC data point to input outputs */
    69     s->proc->data_in = (float *) input->data[i];
    70     s->proc->data_out = (float *) output->data[i];
    71     /* do resampling */
    72     src_process (s->stat, s->proc);
    73   }
     66  /* make SRC_PROC data point to input outputs */
     67  s->proc->data_in = (float *) input->data;
     68  s->proc->data_out = (float *) output->data;
     69  /* do resampling */
     70  src_process (s->stat, s->proc);
    7471}
    7572
     
    8784
    8885void
    89 del_aubio_resampler (aubio_resampler_t * s)
     86del_aubio_resampler (aubio_resampler_t * s UNUSED)
    9087{
    9188}
    9289
    9390void
    94 aubio_resampler_do (aubio_resampler_t * s, fvec_t * input, fvec_t * output)
     91aubio_resampler_do (aubio_resampler_t * s UNUSED, fvec_t * input UNUSED, fvec_t * output UNUSED)
    9592{
    9693}
Note: See TracChangeset for help on using the changeset viewer.