- Timestamp:
- Dec 4, 2009, 1:39:30 AM (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:
- d207300
- Parents:
- d95ff38
- Location:
- src/temporal
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/temporal/a_weighting.c
rd95ff38 r741bdda 32 32 lvec_t *bs = aubio_filter_get_feedforward (f); 33 33 lvec_t *as = aubio_filter_get_feedback (f); 34 lsmp_t *b = bs->data [0], *a = as->data[0];34 lsmp_t *b = bs->data, *a = as->data; 35 35 uint_t order = aubio_filter_get_order (f); 36 36 … … 241 241 242 242 aubio_filter_t * 243 new_aubio_filter_a_weighting (uint_t channels, uint_tsamplerate)243 new_aubio_filter_a_weighting (uint_t samplerate) 244 244 { 245 aubio_filter_t *f = new_aubio_filter (7 , channels);245 aubio_filter_t *f = new_aubio_filter (7); 246 246 aubio_filter_set_a_weighting (f, samplerate); 247 247 return f; -
src/temporal/a_weighting.h
rd95ff38 r741bdda 61 61 /** create new A-design filter 62 62 63 \param channels number of channels to allocate64 63 \param samplerate sampling frequency of the signal to filter. Should be one of 65 64 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, and … … 69 68 70 69 */ 71 aubio_filter_t *new_aubio_filter_a_weighting (uint_t channels, 72 uint_t samplerate); 70 aubio_filter_t *new_aubio_filter_a_weighting (uint_t samplerate); 73 71 74 72 /** set feedback and feedforward coefficients of a A-weighting filter -
src/temporal/biquad.c
rd95ff38 r741bdda 36 36 return AUBIO_FAIL; 37 37 } 38 bs->data[0] [0]= b0;39 bs->data[ 0][1] = b1;40 bs->data[ 0][2] = b2;41 as->data[0] [0]= 1.;42 as->data[ 0][1] = a1;43 as->data[ 0][1] = a2;38 bs->data[0] = b0; 39 bs->data[1] = b1; 40 bs->data[2] = b2; 41 as->data[0] = 1.; 42 as->data[1] = a1; 43 as->data[1] = a2; 44 44 return AUBIO_OK; 45 45 } 46 46 47 47 aubio_filter_t * 48 new_aubio_filter_biquad (lsmp_t b0, lsmp_t b1, lsmp_t b2, lsmp_t a1, lsmp_t a2, 49 uint_t channels) 48 new_aubio_filter_biquad (lsmp_t b0, lsmp_t b1, lsmp_t b2, lsmp_t a1, lsmp_t a2) 50 49 { 51 aubio_filter_t *f = new_aubio_filter (3 , channels);50 aubio_filter_t *f = new_aubio_filter (3); 52 51 aubio_filter_set_biquad (f, b0, b1, b2, a1, a2); 53 52 return f; -
src/temporal/biquad.h
rd95ff38 r741bdda 62 62 \param a1 feedback filter coefficient 63 63 \param a2 feedback filter coefficient 64 \param channels number of channels to allocate65 64 66 65 */ 67 66 aubio_filter_t *new_aubio_filter_biquad (lsmp_t b0, lsmp_t b1, lsmp_t b2, 68 lsmp_t a1, lsmp_t a2 , uint_t channels);67 lsmp_t a1, lsmp_t a2); 69 68 70 69 #ifdef __cplusplus -
src/temporal/c_weighting.c
rd95ff38 r741bdda 32 32 lvec_t *bs = aubio_filter_get_feedforward (f); 33 33 lvec_t *as = aubio_filter_get_feedback (f); 34 lsmp_t *b = bs->data [0], *a = as->data[0];34 lsmp_t *b = bs->data, *a = as->data; 35 35 uint_t order = aubio_filter_get_order (f); 36 36 … … 197 197 } 198 198 199 aubio_filter_t * new_aubio_filter_c_weighting (uint_t channels, uint_tsamplerate) {200 aubio_filter_t * f = new_aubio_filter(5 , channels);199 aubio_filter_t * new_aubio_filter_c_weighting (uint_t samplerate) { 200 aubio_filter_t * f = new_aubio_filter(5); 201 201 aubio_filter_set_c_weighting (f, samplerate); 202 202 return f; -
src/temporal/c_weighting.h
rd95ff38 r741bdda 61 61 /** create new C-design filter 62 62 63 \param channels number of channels to allocate64 63 \param samplerate sampling frequency of the signal to filter. Should be one of 65 64 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, and … … 69 68 70 69 */ 71 aubio_filter_t *new_aubio_filter_c_weighting (uint_t channels, 72 uint_t samplerate); 70 aubio_filter_t *new_aubio_filter_c_weighting (uint_t samplerate); 73 71 74 72 /** set feedback and feedforward coefficients of a C-weighting filter -
src/temporal/filter.c
rd95ff38 r741bdda 49 49 aubio_filter_do (aubio_filter_t * f, fvec_t * in) 50 50 { 51 uint_t i,j, l, order = f->order;52 lsmp_t *x ;53 lsmp_t *y ;54 lsmp_t *a = f->a->data [0];55 lsmp_t *b = f->b->data [0];51 uint_t j, l, order = f->order; 52 lsmp_t *x = f->x->data; 53 lsmp_t *y = f->y->data; 54 lsmp_t *a = f->a->data; 55 lsmp_t *b = f->b->data; 56 56 57 for (i = 0; i < in->channels; i++) { 58 x = f->x->data[i]; 59 y = f->y->data[i]; 60 for (j = 0; j < in->length; j++) { 61 /* new input */ 62 x[0] = KILL_DENORMAL (in->data[i][j]); 63 y[0] = b[0] * x[0]; 64 for (l = 1; l < order; l++) { 65 y[0] += b[l] * x[l]; 66 y[0] -= a[l] * y[l]; 67 } 68 /* new output */ 69 in->data[i][j] = y[0]; 70 /* store for next sample */ 71 for (l = order - 1; l > 0; l--) { 72 x[l] = x[l - 1]; 73 y[l] = y[l - 1]; 74 } 57 for (j = 0; j < in->length; j++) { 58 /* new input */ 59 x[0] = KILL_DENORMAL (in->data[j]); 60 y[0] = b[0] * x[0]; 61 for (l = 1; l < order; l++) { 62 y[0] += b[l] * x[l]; 63 y[0] -= a[l] * y[l]; 75 64 } 76 /* store for next run */ 77 f->x->data[i] = x; 78 f->y->data[i] = y; 65 /* new output */ 66 in->data[j] = y[0]; 67 /* store for next sample */ 68 for (l = order - 1; l > 0; l--) { 69 x[l] = x[l - 1]; 70 y[l] = y[l - 1]; 71 } 79 72 } 80 73 } … … 84 77 aubio_filter_do_filtfilt (aubio_filter_t * f, fvec_t * in, fvec_t * tmp) 85 78 { 86 uint_t j , i = 0;79 uint_t j; 87 80 uint_t length = in->length; 88 81 /* apply filtering */ … … 91 84 /* mirror */ 92 85 for (j = 0; j < length; j++) 93 tmp->data[ i][length - j - 1] = in->data[i][j];86 tmp->data[length - j - 1] = in->data[j]; 94 87 /* apply filtering on mirrored */ 95 88 aubio_filter_do (f, tmp); … … 97 90 /* invert back */ 98 91 for (j = 0; j < length; j++) 99 in->data[ i][j] = tmp->data[i][length - j - 1];92 in->data[j] = tmp->data[length - j - 1]; 100 93 } 101 94 … … 139 132 140 133 aubio_filter_t * 141 new_aubio_filter (uint_t order , uint_t channels)134 new_aubio_filter (uint_t order) 142 135 { 143 136 aubio_filter_t *f = AUBIO_NEW (aubio_filter_t); 144 f->x = new_lvec (order , channels);145 f->y = new_lvec (order , channels);146 f->a = new_lvec (order , 1);147 f->b = new_lvec (order , 1);137 f->x = new_lvec (order); 138 f->y = new_lvec (order); 139 f->a = new_lvec (order); 140 f->b = new_lvec (order); 148 141 /* by default, samplerate is not set */ 149 142 f->samplerate = 0; 150 143 f->order = order; 151 144 /* set default to identity */ 152 f->a->data[ 0][1] = 1.;145 f->a->data[1] = 1.; 153 146 return f; 154 147 } -
src/temporal/filter.h
rd95ff38 r741bdda 26 26 Digital filter 27 27 28 This object stores a digital filter of order \f$n\f$ for \f$c\f$ channels.28 This object stores a digital filter of order \f$n\f$. 29 29 It contains the following data: 30 30 - \f$ n*1 b_i \f$ feedforward coefficients … … 151 151 /** create new filter object 152 152 153 This function creates a new ::aubio_filter_t object, given an order154 and a specific number of channels.153 This function creates a new ::aubio_filter_t object, given the order of the 154 filter. 155 155 156 156 \param order order of the filter (number of coefficients) 157 \param channels number of channels to allocate158 157 159 158 \return the newly created filter object 160 159 161 160 */ 162 aubio_filter_t *new_aubio_filter (uint_t order , uint_t channels);161 aubio_filter_t *new_aubio_filter (uint_t order); 163 162 164 163 /** delete a filter object -
src/temporal/resampler.c
rd95ff38 r741bdda 61 61 aubio_resampler_do (aubio_resampler_t * s, fvec_t * input, fvec_t * output) 62 62 { 63 uint_t i;64 63 s->proc->input_frames = input->length; 65 64 s->proc->output_frames = output->length; 66 65 s->proc->src_ratio = (double) s->ratio; 67 for (i = 0; i < input->channels; i++) { 68 /* make SRC_PROC data point to input outputs */ 69 s->proc->data_in = (float *) input->data[i]; 70 s->proc->data_out = (float *) output->data[i]; 71 /* do resampling */ 72 src_process (s->stat, s->proc); 73 } 66 /* make SRC_PROC data point to input outputs */ 67 s->proc->data_in = (float *) input->data; 68 s->proc->data_out = (float *) output->data; 69 /* do resampling */ 70 src_process (s->stat, s->proc); 74 71 } 75 72 … … 87 84 88 85 void 89 del_aubio_resampler (aubio_resampler_t * s )86 del_aubio_resampler (aubio_resampler_t * s UNUSED) 90 87 { 91 88 } 92 89 93 90 void 94 aubio_resampler_do (aubio_resampler_t * s , fvec_t * input, fvec_t * output)91 aubio_resampler_do (aubio_resampler_t * s UNUSED, fvec_t * input UNUSED, fvec_t * output UNUSED) 95 92 { 96 93 }
Note: See TracChangeset
for help on using the changeset viewer.