Changeset bafe71d
- Timestamp:
- Nov 3, 2009, 4:22:39 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:
- 31907fd
- Parents:
- fddfa64
- Location:
- src/temporal
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/temporal/a_weighting.h
rfddfa64 rbafe71d 80 80 81 81 */ 82 uint_t aubio_filter_set_a_weighting (aubio_filter_t * f, uint_t samplerate);82 uint_t aubio_filter_set_a_weighting (aubio_filter_t * f, uint_t samplerate); 83 83 84 84 #ifdef __cplusplus -
src/temporal/biquad.c
rfddfa64 rbafe71d 26 26 uint_t 27 27 aubio_filter_set_biquad (aubio_filter_t * f, lsmp_t b0, lsmp_t b1, lsmp_t b2, 28 lsmp_t a1, lsmp_t a2) { 28 lsmp_t a1, lsmp_t a2) 29 { 29 30 uint_t order = aubio_filter_get_order (f); 30 31 lvec_t *bs = aubio_filter_get_feedforward (f); -
src/temporal/filter.c
rfddfa64 rbafe71d 81 81 82 82 /* The rough way: reset memory of filter between each run to avoid end effects. */ 83 void aubio_filter_do_filtfilt(aubio_filter_t * f, fvec_t * in, fvec_t * tmp) { 84 uint_t j,i=0; 83 void 84 aubio_filter_do_filtfilt (aubio_filter_t * f, fvec_t * in, fvec_t * tmp) 85 { 86 uint_t j, i = 0; 85 87 uint_t length = in->length; 86 88 /* apply filtering */ 87 aubio_filter_do (f,in);88 aubio_filter_do_reset (f);89 aubio_filter_do (f, in); 90 aubio_filter_do_reset (f); 89 91 /* mirror */ 90 92 for (j = 0; j < length; j++) 91 tmp->data[i][length -j-1] = in->data[i][j];93 tmp->data[i][length - j - 1] = in->data[i][j]; 92 94 /* apply filtering on mirrored */ 93 aubio_filter_do (f,tmp);94 aubio_filter_do_reset (f);95 aubio_filter_do (f, tmp); 96 aubio_filter_do_reset (f); 95 97 /* invert back */ 96 98 for (j = 0; j < length; j++) 97 in->data[i][j] = tmp->data[i][length -j-1];99 in->data[i][j] = tmp->data[i][length - j - 1]; 98 100 } 99 101 … … 132 134 aubio_filter_do_reset (aubio_filter_t * f) 133 135 { 134 lvec_zeros (f->x);135 lvec_zeros (f->y);136 lvec_zeros (f->x); 137 lvec_zeros (f->y); 136 138 } 137 139 -
src/temporal/resampler.c
rfddfa64 rbafe71d 23 23 #if HAVE_SAMPLERATE 24 24 25 #include <samplerate.h> /* from libsamplerate */25 #include <samplerate.h> /* from libsamplerate */ 26 26 27 27 #include "aubio_priv.h" … … 29 29 #include "temporal/resampler.h" 30 30 31 struct _aubio_resampler_t { 32 SRC_DATA *proc; 33 SRC_STATE *stat; 34 smpl_t ratio; 35 uint_t type; 31 struct _aubio_resampler_t 32 { 33 SRC_DATA *proc; 34 SRC_STATE *stat; 35 smpl_t ratio; 36 uint_t type; 36 37 }; 37 38 38 aubio_resampler_t * new_aubio_resampler(smpl_t ratio, uint_t type) { 39 aubio_resampler_t * s = AUBIO_NEW(aubio_resampler_t); 40 int error = 0; 41 s->stat = src_new (type, 1, &error) ; /* only one channel */ 42 s->proc = AUBIO_NEW(SRC_DATA); 43 if (error) AUBIO_ERR("%s\n",src_strerror(error)); 44 s->ratio = ratio; 45 return s; 39 aubio_resampler_t * 40 new_aubio_resampler (smpl_t ratio, uint_t type) 41 { 42 aubio_resampler_t *s = AUBIO_NEW (aubio_resampler_t); 43 int error = 0; 44 s->stat = src_new (type, 1, &error); /* only one channel */ 45 s->proc = AUBIO_NEW (SRC_DATA); 46 if (error) 47 AUBIO_ERR ("%s\n", src_strerror (error)); 48 s->ratio = ratio; 49 return s; 46 50 } 47 51 48 void del_aubio_resampler(aubio_resampler_t *s) { 49 src_delete(s->stat); 50 AUBIO_FREE(s->proc); 51 AUBIO_FREE(s); 52 void 53 del_aubio_resampler (aubio_resampler_t * s) 54 { 55 src_delete (s->stat); 56 AUBIO_FREE (s->proc); 57 AUBIO_FREE (s); 52 58 } 53 59 54 void aubio_resampler_do (aubio_resampler_t *s,55 fvec_t * input, fvec_t * output) { 56 uint_t i ; 57 s->proc->input_frames = input->length;58 s->proc->output_frames = output->length;59 s->proc->src_ratio = (double)s->ratio;60 for (i = 0 ; i< input->channels; i++) 61 62 63 s->proc->data_in = (float *)input->data[i];64 s->proc->data_out= (float *)output->data[i];65 66 src_process (s->stat, s->proc);67 68 } 60 void 61 aubio_resampler_do (aubio_resampler_t * s, fvec_t * input, fvec_t * output) 62 { 63 uint_t i; 64 s->proc->input_frames = input->length; 65 s->proc->output_frames = output->length; 66 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 } 74 } 69 75 70 76 #endif /* HAVE_SAMPLERATE */ -
src/temporal/resampler.h
rfddfa64 rbafe71d 46 46 47 47 */ 48 aubio_resampler_t * new_aubio_resampler(smpl_t ratio, uint_t type);48 aubio_resampler_t *new_aubio_resampler (smpl_t ratio, uint_t type); 49 49 50 50 /** delete resampler object */ 51 void del_aubio_resampler (aubio_resampler_t *s);51 void del_aubio_resampler (aubio_resampler_t * s); 52 52 53 53 /** resample input in output … … 58 58 59 59 */ 60 void aubio_resampler_do (aubio_resampler_t *s, fvec_t * input, fvec_t * output); 60 void aubio_resampler_do (aubio_resampler_t * s, fvec_t * input, 61 fvec_t * output); 61 62 62 63 #ifdef __cplusplus
Note: See TracChangeset
for help on using the changeset viewer.