Changeset 59c046d for src/temporal/c_weighting.c
- Timestamp:
- Oct 19, 2009, 1:52:04 PM (14 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/c_weighting.c
rb14107f r59c046d 26 26 #include "temporal/c_weighting.h" 27 27 28 uint_t aubio_filter_set_c_weighting (aubio_filter_t * f) { 29 30 uint_t samplerate = aubio_filter_get_samplerate (f); 31 lvec_t * bs = aubio_filter_get_feedforward (f); 32 lvec_t * as = aubio_filter_get_feedback (f); 28 uint_t 29 aubio_filter_set_c_weighting (aubio_filter_t * f, uint_t samplerate) 30 { 31 aubio_filter_set_samplerate (f, samplerate); 32 lvec_t *bs = aubio_filter_get_feedforward (f); 33 lvec_t *as = aubio_filter_get_feedback (f); 33 34 lsmp_t *b = bs->data[0], *a = as->data[0]; 34 35 uint_t order = aubio_filter_get_order (f); 35 36 36 37 if ( order != 5 ) { 37 AUBIO_ERROR ( "order of C-weighting filter must be 5, not %d\n", order);38 AUBIO_ERROR ("order of C-weighting filter must be 5, not %d\n", order); 38 39 return 1; 39 40 } 40 41 41 42 /* select coefficients according to sampling frequency */ 42 switch ( samplerate ) { 43 44 // cdsgn 8000 43 switch (samplerate) { 44 45 45 case 8000: 46 46 b[0] = 6.782173932405135552414776611840352416038513183593750000e-01; … … 56 56 break; 57 57 58 // cdsgn 1102559 58 case 11025: 60 59 b[0] = 6.002357155402652244546857218665536493062973022460937500e-01; … … 70 69 break; 71 70 72 // cdsgn 1600073 71 case 16000: 74 72 b[0] = 4.971057193673903418229542694461997598409652709960937500e-01; … … 84 82 break; 85 83 86 // cdsgn 2205087 84 case 22050: 88 85 b[0] = 4.033381299002754549754001800465630367398262023925781250e-01; … … 98 95 break; 99 96 100 // cdsgn 24000101 97 case 24000: 102 98 b[0] = 3.786678621924967069745093795063439756631851196289062500e-01; … … 112 108 break; 113 109 114 // cdsgn 32000115 110 case 32000: 116 111 b[0] = 2.977986488230693340462096330156782642006874084472656250e-01; … … 126 121 break; 127 122 128 // cdsgn 44100129 123 case 44100: 130 124 b[0] = 2.170085619492190254220531642204150557518005371093750000e-01; … … 140 134 break; 141 135 142 // cdsgn 48000143 136 case 48000: 144 137 b[0] = 1.978871200263932761398422144338837824761867523193359375e-01; … … 154 147 break; 155 148 156 // cdsgn 88200157 149 case 88200: 158 150 b[0] = 9.221909851156021020734954163344809785485267639160156250e-02; … … 168 160 break; 169 161 170 // cdsgn 96000171 162 case 96000: 172 163 b[0] = 8.182864044979756834585771230194950476288795471191406250e-02; … … 182 173 break; 183 174 184 // cdsgn 192000185 175 case 192000: 186 176 b[0] = 2.784755468532278815940728122768632601946592330932617188e-02; … … 207 197 } 208 198 209 aubio_filter_t * new_aubio_filter_c_weighting (uint_t samplerate, uint_t channels) {210 aubio_filter_t * f = new_aubio_filter( samplerate,5, channels);211 aubio_filter_set_c_weighting (f );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); 201 aubio_filter_set_c_weighting (f, samplerate); 212 202 return f; 213 203 }
Note: See TracChangeset
for help on using the changeset viewer.