Ignore:
Timestamp:
Oct 19, 2009, 1:52:04 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:
b01bd4a
Parents:
b14107f
Message:

src/spectral/filter.c, src/temporal/filterbank_mel.c: move samplerate to the end

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/temporal/a_weighting.c

    rb14107f r59c046d  
    11/*
    2 
    32  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
    43
     
    2726#include "temporal/a_weighting.h"
    2827
    29 uint_t aubio_filter_set_a_weighting (aubio_filter_t * f) {
    30 
    31   uint_t samplerate = aubio_filter_get_samplerate (f);
     28uint_t
     29aubio_filter_set_a_weighting (aubio_filter_t * f, uint_t samplerate)
     30{
     31  aubio_filter_set_samplerate (f, samplerate);
    3232  lvec_t *bs = aubio_filter_get_feedforward (f);
    3333  lvec_t *as = aubio_filter_get_feedback (f);
     
    3535  uint_t order = aubio_filter_get_order (f);
    3636
    37   if ( order != 7 ) {
    38     AUBIO_ERROR ( "order of A-weighting filter must be 7, not %d\n", order );
     37  if (order != 7) {
     38    AUBIO_ERROR ("order of A-weighting filter must be 7, not %d\n", order);
    3939    return 1;
    4040  }
    4141
    4242  /* select coefficients according to sampling frequency */
    43   switch ( samplerate ) {
    44 
    45     // adsgn 8000
     43  switch (samplerate) {
     44
    4645    case 8000:
    4746      b[0] =  6.306209468238731519207362907764036208391189575195312500e-01;
     
    6160      break;
    6261
    63     // adsgn 11025
    6462    case 11025:
    6563      b[0] =  6.014684165832374640459079273568931967020034790039062500e-01;
     
    7977      break;
    8078
    81     // adsgn 16000
    8279    case 16000:
    8380      b[0] =  5.314898298235570806014038680586963891983032226562500000e-01;
     
    9794      break;
    9895
    99     // adsgn 22050
    10096    case 22050:
    10197      b[0] =  4.492998504299193784916610638902056962251663208007812500e-01;
     
    115111      break;
    116112
    117     // adsgn 24000
    118113    case 24000:
    119114      b[0] =  4.256263892891054001488271296693710610270500183105468750e-01;
     
    133128      break;
    134129
    135     // adsgn 32000
    136130    case 32000:
    137131      b[0] =  3.434583386824304196416335344110848382115364074707031250e-01;
     
    151145      break;
    152146
    153     // adsgn 44100
    154147    case 44100:
    155148      b[0] =  2.557411252042575133813784304948057979345321655273437500e-01;
     
    169162      break;
    170163
    171     // adsgn 48000
    172164    case 48000:
    173165      b[0] =  2.343017922995132285013397677175817079842090606689453125e-01;
     
    187179      break;
    188180
    189     // adsgn 88200
    190181    case 88200:
    191182      b[0] =  1.118876366882113199130444058937428053468465805053710938e-01;
     
    205196      break;
    206197
    207     // adsgn 96000
    208198    case 96000:
    209199      b[0] =  9.951898975972744976203898659150581806898117065429687500e-02;
     
    223213      break;
    224214
    225     // adsgn 192000
    226215    case 192000:
    227216      b[0] =  3.433213424548713782469278044118254911154508590698242188e-02;
     
    241230      break;
    242231
    243     default:
    244       AUBIO_ERROR ( "sampling rate of A-weighting filter is %d, should be one of\
    245  8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, 192000.\n",
    246  samplerate );
     232    default:
     233      AUBIO_ERROR ("sampling rate of A-weighting filter is %d, should be one of\
     234 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, 192000.\n", samplerate);
    247235      return 1;
    248236
     
    252240}
    253241
    254 aubio_filter_t * new_aubio_filter_a_weighting (uint_t samplerate, uint_t channels) {
    255   aubio_filter_t * f = new_aubio_filter (samplerate, 7, channels);
    256   aubio_filter_set_a_weighting (f);
     242aubio_filter_t *
     243new_aubio_filter_a_weighting (uint_t channels, uint_t samplerate)
     244{
     245  aubio_filter_t *f = new_aubio_filter (7, channels);
     246  aubio_filter_set_a_weighting (f, samplerate);
    257247  return f;
    258248}
    259 
Note: See TracChangeset for help on using the changeset viewer.