Changeset 9590e81 for src/temporal
- Timestamp:
- Feb 9, 2016, 3:24:53 PM (9 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:
- 1175883
- Parents:
- a33d406
- Location:
- src/temporal
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/temporal/a_weighting.c
ra33d406 r9590e81 30 30 { 31 31 uint_t order; lsmp_t *a, *b; lvec_t *as, *bs; 32 33 if ((sint_t)samplerate <= 0) { 34 AUBIO_ERROR("aubio_filter: failed setting A-weighting with samplerate %d\n", samplerate); 35 return AUBIO_FAIL; 36 } 37 if (f == NULL) { 38 AUBIO_ERROR("aubio_filter: failed setting A-weighting with filter NULL\n"); 39 return AUBIO_FAIL; 40 } 41 42 order = aubio_filter_get_order (f); 43 if (order != 7) { 44 AUBIO_ERROR ("aubio_filter: order of A-weighting filter must be 7, not %d\n", order); 45 return 1; 46 } 47 32 48 aubio_filter_set_samplerate (f, samplerate); 33 49 bs = aubio_filter_get_feedforward (f); 34 50 as = aubio_filter_get_feedback (f); 35 51 b = bs->data, a = as->data; 36 order = aubio_filter_get_order (f);37 38 if (order != 7) {39 AUBIO_ERROR ("order of A-weighting filter must be 7, not %d\n", order);40 return 1;41 }42 52 43 53 /* select coefficients according to sampling frequency */ … … 245 255 { 246 256 aubio_filter_t *f = new_aubio_filter (7); 247 aubio_filter_set_a_weighting (f, samplerate); 257 if (aubio_filter_set_a_weighting(f,samplerate) != AUBIO_OK) { 258 del_aubio_filter(f); 259 return NULL; 260 } 248 261 return f; 249 262 } -
src/temporal/c_weighting.c
ra33d406 r9590e81 30 30 { 31 31 uint_t order; lsmp_t *a, *b; lvec_t *as, *bs; 32 33 if ((sint_t)samplerate <= 0) { 34 AUBIO_ERROR("aubio_filter: failed setting C-weighting with samplerate %d\n", samplerate); 35 return AUBIO_FAIL; 36 } 37 if (f == NULL) { 38 AUBIO_ERROR("aubio_filter: failed setting C-weighting with filter NULL\n"); 39 return AUBIO_FAIL; 40 } 41 42 order = aubio_filter_get_order (f); 43 if ( order != 5 ) { 44 AUBIO_ERROR ("aubio_filter: order of C-weighting filter must be 5, not %d\n", order); 45 return 1; 46 } 47 32 48 aubio_filter_set_samplerate (f, samplerate); 33 49 bs = aubio_filter_get_feedforward (f); 34 50 as = aubio_filter_get_feedback (f); 35 51 b = bs->data, a = as->data; 36 order = aubio_filter_get_order (f);37 38 if ( order != 5 ) {39 AUBIO_ERROR ("order of C-weighting filter must be 5, not %d\n", order);40 return 1;41 }42 52 43 53 /* select coefficients according to sampling frequency */ … … 200 210 aubio_filter_t * new_aubio_filter_c_weighting (uint_t samplerate) { 201 211 aubio_filter_t * f = new_aubio_filter(5); 202 aubio_filter_set_c_weighting (f, samplerate); 212 if (aubio_filter_set_c_weighting(f,samplerate) != AUBIO_OK) { 213 del_aubio_filter(f); 214 return NULL; 215 } 203 216 return f; 204 217 } 205 -
src/temporal/filter.c
ra33d406 r9590e81 135 135 { 136 136 aubio_filter_t *f = AUBIO_NEW (aubio_filter_t); 137 if ((sint_t)order < 1) { 138 AUBIO_FREE(f); 139 return NULL; 140 } 137 141 f->x = new_lvec (order); 138 142 f->y = new_lvec (order); … … 143 147 f->order = order; 144 148 /* set default to identity */ 145 f->a->data[1] = 1.; 149 f->a->data[0] = 1.; 150 f->b->data[0] = 1.; 146 151 return f; 147 152 }
Note: See TracChangeset
for help on using the changeset viewer.