Changeset 633400d for src/spectral/filterbank.c
- Timestamp:
- Dec 5, 2018, 10:34:39 PM (5 years ago)
- Branches:
- feature/cnn, feature/crepe, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
- Children:
- 283a619a
- Parents:
- 5b46bc3 (diff), f19db54 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/spectral/filterbank.c
r5b46bc3 r633400d 24 24 #include "fmat.h" 25 25 #include "cvec.h" 26 #include "vecutils.h" 26 27 #include "spectral/filterbank.h" 27 28 #include "mathutils.h" … … 33 34 uint_t n_filters; 34 35 fmat_t *filters; 36 smpl_t norm; 37 smpl_t power; 35 38 }; 36 39 … … 40 43 /* allocate space for filterbank object */ 41 44 aubio_filterbank_t *fb = AUBIO_NEW (aubio_filterbank_t); 45 46 if ((sint_t)n_filters <= 0) { 47 AUBIO_ERR("filterbank: n_filters should be > 0, got %d\n", n_filters); 48 goto fail; 49 } 50 if ((sint_t)win_s <= 0) { 51 AUBIO_ERR("filterbank: win_s should be > 0, got %d\n", win_s); 52 goto fail; 53 } 42 54 fb->win_s = win_s; 43 55 fb->n_filters = n_filters; … … 46 58 fb->filters = new_fmat (n_filters, win_s / 2 + 1); 47 59 60 fb->norm = 1; 61 62 fb->power = 1; 63 48 64 return fb; 65 fail: 66 AUBIO_FREE (fb); 67 return NULL; 49 68 } 50 69 … … 68 87 tmp.data = in->norm; 69 88 89 if (f->power != 1.) fvec_pow(&tmp, f->power); 90 70 91 fmat_vecmul(f->filters, &tmp, out); 71 92 … … 85 106 return 0; 86 107 } 108 109 uint_t 110 aubio_filterbank_set_norm (aubio_filterbank_t *f, smpl_t norm) 111 { 112 if (norm != 0 && norm != 1) return AUBIO_FAIL; 113 f->norm = norm; 114 return AUBIO_OK; 115 } 116 117 smpl_t 118 aubio_filterbank_get_norm (aubio_filterbank_t *f) 119 { 120 return f->norm; 121 } 122 123 uint_t 124 aubio_filterbank_set_power (aubio_filterbank_t *f, smpl_t power) 125 { 126 f->power = power; 127 return AUBIO_OK; 128 } 129 130 smpl_t 131 aubio_filterbank_get_power (aubio_filterbank_t *f) 132 { 133 return f->power; 134 }
Note: See TracChangeset
for help on using the changeset viewer.