Changeset 59c046d for src/temporal/a_weighting.c
- Timestamp:
- Oct 19, 2009, 1:52:04 PM (15 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/temporal/a_weighting.c
rb14107f r59c046d 1 1 /* 2 3 2 Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> 4 3 … … 27 26 #include "temporal/a_weighting.h" 28 27 29 uint_t aubio_filter_set_a_weighting (aubio_filter_t * f) { 30 31 uint_t samplerate = aubio_filter_get_samplerate (f); 28 uint_t 29 aubio_filter_set_a_weighting (aubio_filter_t * f, uint_t samplerate) 30 { 31 aubio_filter_set_samplerate (f, samplerate); 32 32 lvec_t *bs = aubio_filter_get_feedforward (f); 33 33 lvec_t *as = aubio_filter_get_feedback (f); … … 35 35 uint_t order = aubio_filter_get_order (f); 36 36 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); 39 39 return 1; 40 40 } 41 41 42 42 /* select coefficients according to sampling frequency */ 43 switch ( samplerate ) { 44 45 // adsgn 8000 43 switch (samplerate) { 44 46 45 case 8000: 47 46 b[0] = 6.306209468238731519207362907764036208391189575195312500e-01; … … 61 60 break; 62 61 63 // adsgn 1102564 62 case 11025: 65 63 b[0] = 6.014684165832374640459079273568931967020034790039062500e-01; … … 79 77 break; 80 78 81 // adsgn 1600082 79 case 16000: 83 80 b[0] = 5.314898298235570806014038680586963891983032226562500000e-01; … … 97 94 break; 98 95 99 // adsgn 22050100 96 case 22050: 101 97 b[0] = 4.492998504299193784916610638902056962251663208007812500e-01; … … 115 111 break; 116 112 117 // adsgn 24000118 113 case 24000: 119 114 b[0] = 4.256263892891054001488271296693710610270500183105468750e-01; … … 133 128 break; 134 129 135 // adsgn 32000136 130 case 32000: 137 131 b[0] = 3.434583386824304196416335344110848382115364074707031250e-01; … … 151 145 break; 152 146 153 // adsgn 44100154 147 case 44100: 155 148 b[0] = 2.557411252042575133813784304948057979345321655273437500e-01; … … 169 162 break; 170 163 171 // adsgn 48000172 164 case 48000: 173 165 b[0] = 2.343017922995132285013397677175817079842090606689453125e-01; … … 187 179 break; 188 180 189 // adsgn 88200190 181 case 88200: 191 182 b[0] = 1.118876366882113199130444058937428053468465805053710938e-01; … … 205 196 break; 206 197 207 // adsgn 96000208 198 case 96000: 209 199 b[0] = 9.951898975972744976203898659150581806898117065429687500e-02; … … 223 213 break; 224 214 225 // adsgn 192000226 215 case 192000: 227 216 b[0] = 3.433213424548713782469278044118254911154508590698242188e-02; … … 241 230 break; 242 231 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); 247 235 return 1; 248 236 … … 252 240 } 253 241 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); 242 aubio_filter_t * 243 new_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); 257 247 return f; 258 248 } 259
Note: See TracChangeset
for help on using the changeset viewer.