Changeset c03d191 for src/spectral
- Timestamp:
- Nov 17, 2018, 10:19:27 PM (6 years ago)
- Branches:
- feature/constantq
- Children:
- d1d4ad4
- Parents:
- 088760e (diff), a114fe0 (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. - Location:
- src/spectral
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/spectral/fft.c
r088760e rc03d191 90 90 #define aubio_vDSP_vsadd vDSP_vsadd 91 91 #define aubio_vDSP_vsmul vDSP_vsmul 92 #define aubio_vDSP_create_fftsetup vDSP_create_fftsetup93 #define aubio_vDSP_destroy_fftsetup vDSP_destroy_fftsetup94 92 #define aubio_DSPComplex DSPComplex 95 93 #define aubio_DSPSplitComplex DSPSplitComplex 96 #define aubio_FFTSetup FFTSetup 94 #define aubio_vDSP_DFT_Setup vDSP_DFT_Setup 95 #define aubio_vDSP_DFT_zrop_CreateSetup vDSP_DFT_zrop_CreateSetup 96 #define aubio_vDSP_DFT_Execute vDSP_DFT_Execute 97 #define aubio_vDSP_DFT_DestroySetup vDSP_DFT_DestroySetup 97 98 #define aubio_vvsqrt vvsqrtf 98 99 #else … … 104 105 #define aubio_vDSP_vsadd vDSP_vsaddD 105 106 #define aubio_vDSP_vsmul vDSP_vsmulD 106 #define aubio_vDSP_create_fftsetup vDSP_create_fftsetupD107 #define aubio_vDSP_destroy_fftsetup vDSP_destroy_fftsetupD108 107 #define aubio_DSPComplex DSPDoubleComplex 109 108 #define aubio_DSPSplitComplex DSPDoubleSplitComplex 110 #define aubio_FFTSetup FFTSetupD 109 #define aubio_vDSP_DFT_Setup vDSP_DFT_SetupD 110 #define aubio_vDSP_DFT_zrop_CreateSetup vDSP_DFT_zrop_CreateSetupD 111 #define aubio_vDSP_DFT_Execute vDSP_DFT_ExecuteD 112 #define aubio_vDSP_DFT_DestroySetup vDSP_DFT_DestroySetupD 111 113 #define aubio_vvsqrt vvsqrt 112 114 #endif /* HAVE_AUBIO_DOUBLE */ … … 153 155 154 156 #elif defined HAVE_ACCELERATE // using ACCELERATE 155 int log2fftsize;156 aubio_ FFTSetup fftSetup;157 aubio_vDSP_DFT_Setup fftSetupFwd; 158 aubio_vDSP_DFT_Setup fftSetupBwd; 157 159 aubio_DSPSplitComplex spec; 158 160 smpl_t *in, *out; … … 211 213 212 214 #elif defined HAVE_ACCELERATE // using ACCELERATE 215 { 216 uint_t radix = winsize; 217 uint_t order = 0; 218 while ((radix / 2) * 2 == radix) { 219 radix /= 2; 220 order++; 221 } 222 if (order < 4 || (radix != 1 && radix != 3 && radix != 5 && radix != 15)) { 223 AUBIO_ERR("fft: vDSP/Accelerate supports FFT with sizes = " 224 "f * 2 ** n, where n > 4 and f in [1, 3, 5, 15], but requested %d. " 225 "Use the closest power of two, or try recompiling aubio with " 226 "--enable-fftw3.\n", winsize); 227 goto beach; 228 } 229 } 213 230 s->winsize = winsize; 214 231 s->fft_size = winsize; 215 232 s->compspec = new_fvec(winsize); 216 s->log2fftsize = aubio_power_of_two_order(s->fft_size);217 233 s->in = AUBIO_ARRAY(smpl_t, s->fft_size); 218 234 s->out = AUBIO_ARRAY(smpl_t, s->fft_size); 219 235 s->spec.realp = AUBIO_ARRAY(smpl_t, s->fft_size/2); 220 236 s->spec.imagp = AUBIO_ARRAY(smpl_t, s->fft_size/2); 221 s->fftSetup = aubio_vDSP_create_fftsetup(s->log2fftsize, FFT_RADIX2); 237 s->fftSetupFwd = aubio_vDSP_DFT_zrop_CreateSetup(NULL, 238 s->fft_size, vDSP_DFT_FORWARD); 239 s->fftSetupBwd = aubio_vDSP_DFT_zrop_CreateSetup(s->fftSetupFwd, 240 s->fft_size, vDSP_DFT_INVERSE); 222 241 223 242 #elif defined HAVE_INTEL_IPP // using Intel IPP … … 293 312 AUBIO_FREE(s->spec.realp); 294 313 AUBIO_FREE(s->spec.imagp); 295 aubio_vDSP_destroy_fftsetup(s->fftSetup); 314 aubio_vDSP_DFT_DestroySetup(s->fftSetupBwd); 315 aubio_vDSP_DFT_DestroySetup(s->fftSetupFwd); 296 316 297 317 #elif defined HAVE_INTEL_IPP // using Intel IPP … … 351 371 aubio_vDSP_ctoz((aubio_DSPComplex*)s->in, 2, &s->spec, 1, s->fft_size/2); 352 372 // compute the FFT 353 aubio_vDSP_fft_zrip(s->fftSetup, &s->spec, 1, s->log2fftsize, FFT_FORWARD); 373 aubio_vDSP_DFT_Execute(s->fftSetupFwd, s->spec.realp, s->spec.imagp, 374 s->spec.realp, s->spec.imagp); 354 375 // convert from vDSP complex split to [ r0, r1, ..., rN, iN-1, .., i2, i1] 355 376 compspec->data[0] = s->spec.realp[0]; … … 419 440 aubio_vDSP_ctoz((aubio_DSPComplex*)s->out, 2, &s->spec, 1, s->fft_size/2); 420 441 // compute the FFT 421 aubio_vDSP_fft_zrip(s->fftSetup, &s->spec, 1, s->log2fftsize, FFT_INVERSE); 442 aubio_vDSP_DFT_Execute(s->fftSetupBwd, s->spec.realp, s->spec.imagp, 443 s->spec.realp, s->spec.imagp); 422 444 // convert result to real output 423 445 aubio_vDSP_ztoc(&s->spec, 1, (aubio_DSPComplex*)output->data, 2, s->fft_size/2); … … 494 516 } 495 517 #endif 496 if (compspec->data[compspec->length/2] < 0) { 497 spectrum->phas[spectrum->length - 1] = PI; 518 #ifdef HAVE_FFTW3 519 // for even length only, make sure last element is 0 or PI 520 if (2 * (compspec->length / 2) == compspec->length) { 521 #endif 522 if (compspec->data[compspec->length/2] < 0) { 523 spectrum->phas[spectrum->length - 1] = PI; 524 } else { 525 spectrum->phas[spectrum->length - 1] = 0.; 526 } 527 #ifdef HAVE_FFTW3 498 528 } else { 499 spectrum->phas[spectrum->length - 1] = 0.; 500 } 529 i = spectrum->length - 1; 530 spectrum->phas[i] = ATAN2(compspec->data[compspec->length-i], 531 compspec->data[i]); 532 } 533 #endif 501 534 } 502 535 … … 508 541 + SQR(compspec->data[compspec->length - i]) ); 509 542 } 510 spectrum->norm[spectrum->length-1] = 511 ABS(compspec->data[compspec->length/2]); 543 #ifdef HAVE_FFTW3 544 // for even length, make sure last element is > 0 545 if (2 * (compspec->length / 2) == compspec->length) { 546 #endif 547 spectrum->norm[spectrum->length-1] = 548 ABS(compspec->data[compspec->length/2]); 549 #ifdef HAVE_FFTW3 550 } else { 551 i = spectrum->length - 1; 552 spectrum->norm[i] = SQRT(SQR(compspec->data[i]) 553 + SQR(compspec->data[compspec->length - i]) ); 554 } 555 #endif 512 556 } 513 557 -
src/spectral/filterbank.c
r088760e rc03d191 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 … … 45 48 /* allocate filter tables, a matrix of length win_s and of height n_filters */ 46 49 fb->filters = new_fmat (n_filters, win_s / 2 + 1); 50 51 fb->norm = 1; 52 53 fb->power = 1; 47 54 48 55 return fb; … … 68 75 tmp.data = in->norm; 69 76 77 if (f->power != 1.) fvec_pow(&tmp, f->power); 78 70 79 fmat_vecmul(f->filters, &tmp, out); 71 80 … … 85 94 return 0; 86 95 } 96 97 uint_t 98 aubio_filterbank_set_norm (aubio_filterbank_t *f, smpl_t norm) 99 { 100 if (norm != 0 && norm != 1) return AUBIO_FAIL; 101 f->norm = norm; 102 return AUBIO_OK; 103 } 104 105 smpl_t 106 aubio_filterbank_get_norm (aubio_filterbank_t *f) 107 { 108 return f->norm; 109 } 110 111 uint_t 112 aubio_filterbank_set_power (aubio_filterbank_t *f, smpl_t power) 113 { 114 f->power = power; 115 return AUBIO_OK; 116 } 117 118 smpl_t 119 aubio_filterbank_get_power (aubio_filterbank_t *f) 120 { 121 return f->norm; 122 } -
src/spectral/filterbank.h
r088760e rc03d191 84 84 uint_t aubio_filterbank_set_coeffs (aubio_filterbank_t * f, const fmat_t * filters); 85 85 86 /** set norm parameter 87 88 \param f filterbank object, as returned by new_aubio_filterbank() 89 \param norm `1` to norm the filters, `0` otherwise. 90 91 If set to `0`, the filters will not be normalized. If set to `1`, 92 each filter will be normalized to one. Defaults to `1`. 93 94 This function should be called *before* setting the filters with one of 95 aubio_filterbank_set_triangle_bands(), aubio_filterbank_set_mel_coeffs(), 96 aubio_filterbank_set_mel_coeffs_htk(), or 97 aubio_filterbank_set_mel_coeffs_slaney(). 98 99 */ 100 uint_t aubio_filterbank_set_norm (aubio_filterbank_t *f, smpl_t norm); 101 102 /** get norm parameter 103 104 \param f filterbank object, as returned by new_aubio_filterbank() 105 \returns `1` if norm is set, `0` otherwise. Defaults to `1`. 106 107 */ 108 smpl_t aubio_filterbank_get_norm (aubio_filterbank_t *f); 109 110 /** set power parameter 111 112 \param f filterbank object, as returned by new_aubio_filterbank() 113 \param power Raise norm of the input spectrum norm to this power before 114 computing filterbank. Defaults to `1`. 115 116 */ 117 uint_t aubio_filterbank_set_power (aubio_filterbank_t *f, smpl_t power); 118 119 /** get power parameter 120 121 \param f filterbank object, as returned by new_aubio_filterbank() 122 \return current power parameter. Defaults to `1`. 123 124 */ 125 smpl_t aubio_filterbank_get_power (aubio_filterbank_t *f); 126 86 127 #ifdef __cplusplus 87 128 } -
src/spectral/filterbank_mel.c
r088760e rc03d191 55 55 } 56 56 57 if (freqs->data[freqs->length - 1] > samplerate / 2) { 58 AUBIO_WRN ("Nyquist frequency is %fHz, but highest frequency band ends at \ 59 %fHz\n", samplerate / 2, freqs->data[freqs->length - 1]); 57 for (fn = 0; fn < freqs->length; fn++) { 58 if (freqs->data[fn] < 0) { 59 AUBIO_ERR("filterbank_mel: freqs must contain only positive values.\n"); 60 return AUBIO_FAIL; 61 } else if (freqs->data[fn] > samplerate / 2) { 62 AUBIO_WRN("filterbank_mel: freqs should contain only " 63 "values < samplerate / 2.\n"); 64 } else if (fn > 0 && freqs->data[fn] < freqs->data[fn-1]) { 65 AUBIO_ERR("filterbank_mel: freqs should be a list of frequencies " 66 "sorted from low to high, but freq[%d] < freq[%d-1]\n", fn, fn); 67 return AUBIO_FAIL; 68 } else if (fn > 0 && freqs->data[fn] == freqs->data[fn-1]) { 69 AUBIO_WRN("filterbank_mel: set_triangle_bands received a list " 70 "with twice the frequency %f\n", freqs->data[fn]); 71 } 60 72 } 61 73 … … 79 91 80 92 /* compute triangle heights so that each triangle has unit area */ 81 for (fn = 0; fn < n_filters; fn++) { 82 triangle_heights->data[fn] = 83 2. / (upper_freqs->data[fn] - lower_freqs->data[fn]); 93 if (aubio_filterbank_get_norm(fb)) { 94 for (fn = 0; fn < n_filters; fn++) { 95 triangle_heights->data[fn] = 96 2. / (upper_freqs->data[fn] - lower_freqs->data[fn]); 97 } 98 } else { 99 fvec_ones (triangle_heights); 84 100 } 85 101 … … 92 108 /* zeroing of all filters */ 93 109 fmat_zeros (filters); 94 95 if (fft_freqs->data[1] >= lower_freqs->data[0]) {96 /* - 1 to make sure we don't miss the smallest power of two */97 uint_t min_win_s =98 (uint_t) FLOOR (samplerate / lower_freqs->data[0]) - 1;99 AUBIO_WRN ("Lowest frequency bin (%.2fHz) is higher than lowest frequency \100 band (%.2f-%.2fHz). Consider increasing the window size from %d to %d.\n",101 fft_freqs->data[1], lower_freqs->data[0],102 upper_freqs->data[0], (win_s - 1) * 2,103 aubio_next_power_of_two (min_win_s));104 }105 110 106 111 /* building each filter table */ … … 117 122 118 123 /* compute positive slope step size */ 119 riseInc = 120 triangle_heights->data[fn] / 121 (center_freqs->data[fn] - lower_freqs->data[fn]); 124 riseInc = triangle_heights->data[fn] 125 / (center_freqs->data[fn] - lower_freqs->data[fn]); 122 126 123 127 /* compute coefficients in positive slope */ … … 133 137 134 138 /* compute negative slope step size */ 135 downInc = 136 triangle_heights->data[fn] / 137 (upper_freqs->data[fn] - center_freqs->data[fn]); 139 downInc = triangle_heights->data[fn] 140 / (upper_freqs->data[fn] - center_freqs->data[fn]); 138 141 139 142 /* compute coefficents in negative slope */ … … 161 164 del_fvec (fft_freqs); 162 165 163 return 0;166 return AUBIO_OK; 164 167 } 165 168 … … 168 171 smpl_t samplerate) 169 172 { 170 uint_t retval;171 172 173 /* Malcolm Slaney parameters */ 173 smpl_t lowestFrequency = 133.3333; 174 smpl_t linearSpacing = 66.66666666; 175 smpl_t logSpacing = 1.0711703; 176 177 uint_t linearFilters = 13; 178 uint_t logFilters = 27; 179 uint_t n_filters = linearFilters + logFilters; 180 181 uint_t fn; /* filter counter */ 182 174 const smpl_t lowestFrequency = 133.3333; 175 const smpl_t linearSpacing = 66.66666666; 176 const smpl_t logSpacing = 1.0711703; 177 178 const uint_t linearFilters = 13; 179 const uint_t logFilters = 27; 180 const uint_t n_filters = linearFilters + logFilters; 181 182 uint_t fn, retval; 183 183 smpl_t lastlinearCF; 184 184 185 185 /* buffers to compute filter frequencies */ 186 fvec_t *freqs = new_fvec (n_filters + 2); 186 fvec_t *freqs; 187 188 if (samplerate <= 0) { 189 AUBIO_ERR("filterbank: set_mel_coeffs_slaney samplerate should be > 0\n"); 190 return AUBIO_FAIL; 191 } 192 193 freqs = new_fvec (n_filters + 2); 187 194 188 195 /* first step: fill all the linear filter frequencies */ … … 206 213 return retval; 207 214 } 215 216 static uint_t aubio_filterbank_check_freqs (aubio_filterbank_t *fb UNUSED, 217 smpl_t samplerate, smpl_t *freq_min, smpl_t *freq_max) 218 { 219 if (samplerate <= 0) { 220 AUBIO_ERR("filterbank: set_mel_coeffs samplerate should be > 0\n"); 221 return AUBIO_FAIL; 222 } 223 if (*freq_max < 0) { 224 AUBIO_ERR("filterbank: set_mel_coeffs freq_max should be > 0\n"); 225 return AUBIO_FAIL; 226 } else if (*freq_max == 0) { 227 *freq_max = samplerate / 2.; 228 } 229 if (*freq_min < 0) { 230 AUBIO_ERR("filterbank: set_mel_coeffs freq_min should be > 0\n"); 231 return AUBIO_FAIL; 232 } 233 return AUBIO_OK; 234 } 235 236 uint_t 237 aubio_filterbank_set_mel_coeffs (aubio_filterbank_t * fb, smpl_t samplerate, 238 smpl_t freq_min, smpl_t freq_max) 239 { 240 uint_t m, retval; 241 smpl_t start = freq_min, end = freq_max, step; 242 fvec_t *freqs; 243 fmat_t *coeffs = aubio_filterbank_get_coeffs(fb); 244 uint_t n_bands = coeffs->height; 245 246 if (aubio_filterbank_check_freqs(fb, samplerate, &start, &end)) { 247 return AUBIO_FAIL; 248 } 249 250 start = aubio_hztomel(start); 251 end = aubio_hztomel(end); 252 253 freqs = new_fvec(n_bands + 2); 254 step = (end - start) / (n_bands + 1); 255 256 for (m = 0; m < n_bands + 2; m++) 257 { 258 freqs->data[m] = MIN(aubio_meltohz(start + step * m), samplerate/2.); 259 } 260 261 retval = aubio_filterbank_set_triangle_bands (fb, freqs, samplerate); 262 263 /* destroy vector used to store frequency limits */ 264 del_fvec (freqs); 265 return retval; 266 } 267 268 uint_t 269 aubio_filterbank_set_mel_coeffs_htk (aubio_filterbank_t * fb, smpl_t samplerate, 270 smpl_t freq_min, smpl_t freq_max) 271 { 272 uint_t m, retval; 273 smpl_t start = freq_min, end = freq_max, step; 274 fvec_t *freqs; 275 fmat_t *coeffs = aubio_filterbank_get_coeffs(fb); 276 uint_t n_bands = coeffs->height; 277 278 if (aubio_filterbank_check_freqs(fb, samplerate, &start, &end)) { 279 return AUBIO_FAIL; 280 } 281 282 start = aubio_hztomel_htk(start); 283 end = aubio_hztomel_htk(end); 284 285 freqs = new_fvec (n_bands + 2); 286 step = (end - start) / (n_bands + 1); 287 288 for (m = 0; m < n_bands + 2; m++) 289 { 290 freqs->data[m] = MIN(aubio_meltohz_htk(start + step * m), samplerate/2.); 291 } 292 293 retval = aubio_filterbank_set_triangle_bands (fb, freqs, samplerate); 294 295 /* destroy vector used to store frequency limits */ 296 del_fvec (freqs); 297 return retval; 298 } -
src/spectral/filterbank_mel.h
r088760e rc03d191 56 56 57 57 \param fb filterbank object 58 \param samplerate audio sampling rate 58 \param samplerate audio sampling rate, in Hz 59 59 60 The filter coefficients are built according toMalcolm Slaney's Auditory61 Toolbox , available online at the following address (see file mfcc.m):60 The filter coefficients are built to match exactly Malcolm Slaney's Auditory 61 Toolbox implementation (see file mfcc.m). The number of filters should be 40. 62 62 63 References 64 ---------- 65 66 Malcolm Slaney, *Auditory Toolbox Version 2, Technical Report #1998-010* 63 67 https://engineering.purdue.edu/~malcolm/interval/1998-010/ 64 68 … … 67 71 smpl_t samplerate); 68 72 73 /** Mel filterbank initialization 74 75 \param fb filterbank object 76 \param samplerate audio sampling rate 77 \param fmin start frequency, in Hz 78 \param fmax end frequency, in Hz 79 80 The filterbank will be initialized with bands linearly spaced in the mel 81 scale, from `fmin` to `fmax`. 82 83 References 84 ---------- 85 86 Malcolm Slaney, *Auditory Toolbox Version 2, Technical Report #1998-010* 87 https://engineering.purdue.edu/~malcolm/interval/1998-010/ 88 89 */ 90 uint_t aubio_filterbank_set_mel_coeffs(aubio_filterbank_t * fb, 91 smpl_t samplerate, smpl_t fmin, smpl_t fmax); 92 93 /** Mel filterbank initialization 94 95 \param fb filterbank object 96 \param samplerate audio sampling rate 97 \param fmin start frequency, in Hz 98 \param fmax end frequency, in Hz 99 100 The bank of filters will be initalized to to cover linearly spaced bands in 101 the Htk mel scale, from `fmin` to `fmax`. 102 103 References 104 ---------- 105 106 Douglas O'Shaughnessy (1987). *Speech communication: human and machine*. 107 Addison-Wesley. p. 150. ISBN 978-0-201-16520-3. 108 109 HTK Speech Recognition Toolkit: http://htk.eng.cam.ac.uk/ 110 111 */ 112 uint_t aubio_filterbank_set_mel_coeffs_htk(aubio_filterbank_t * fb, 113 smpl_t samplerate, smpl_t fmin, smpl_t fmax); 114 69 115 #ifdef __cplusplus 70 116 } -
src/spectral/mfcc.c
r088760e rc03d191 52 52 fvec_t *output; 53 53 #endif 54 smpl_t scale; 54 55 }; 55 56 … … 75 76 /* filterbank allocation */ 76 77 mfcc->fb = new_aubio_filterbank (n_filters, mfcc->win_s); 77 aubio_filterbank_set_mel_coeffs_slaney (mfcc->fb, samplerate); 78 if (n_filters == 40) 79 aubio_filterbank_set_mel_coeffs_slaney (mfcc->fb, samplerate); 80 else 81 aubio_filterbank_set_mel_coeffs(mfcc->fb, samplerate, 82 0, samplerate/2.); 78 83 79 84 /* allocating buffers */ … … 97 102 mfcc->output = new_fvec (n_filters); 98 103 #endif 104 105 mfcc->scale = 1.; 99 106 100 107 return mfcc; … … 128 135 fvec_t tmp; 129 136 #endif 137 130 138 /* compute filterbank */ 131 139 aubio_filterbank_do (mf->fb, in, mf->in_dct); … … 134 142 fvec_log10 (mf->in_dct); 135 143 136 /* raise power */ 137 //fvec_pow (mf->in_dct, 3.); 144 if (mf->scale != 1) fvec_mul (mf->in_dct, mf->scale); 138 145 139 146 /* compute mfccs */ … … 151 158 return; 152 159 } 160 161 uint_t aubio_mfcc_set_power (aubio_mfcc_t *mf, smpl_t power) 162 { 163 return aubio_filterbank_set_power(mf->fb, power); 164 } 165 166 uint_t aubio_mfcc_get_power (aubio_mfcc_t *mf) 167 { 168 return aubio_filterbank_get_power(mf->fb); 169 } 170 171 uint_t aubio_mfcc_set_scale (aubio_mfcc_t *mf, smpl_t scale) 172 { 173 mf->scale = scale; 174 return AUBIO_OK; 175 } 176 177 uint_t aubio_mfcc_get_scale (aubio_mfcc_t *mf) 178 { 179 return mf->scale; 180 } 181 182 uint_t aubio_mfcc_set_mel_coeffs (aubio_mfcc_t *mf, smpl_t freq_min, 183 smpl_t freq_max) 184 { 185 return aubio_filterbank_set_mel_coeffs(mf->fb, mf->samplerate, 186 freq_min, freq_max); 187 } 188 189 uint_t aubio_mfcc_set_mel_coeffs_htk (aubio_mfcc_t *mf, smpl_t freq_min, 190 smpl_t freq_max) 191 { 192 return aubio_filterbank_set_mel_coeffs_htk(mf->fb, mf->samplerate, 193 freq_min, freq_max); 194 } 195 196 uint_t aubio_mfcc_set_mel_coeffs_slaney (aubio_mfcc_t *mf) 197 { 198 return aubio_filterbank_set_mel_coeffs_slaney (mf->fb, mf->samplerate); 199 } -
src/spectral/mfcc.h
r088760e rc03d191 74 74 void aubio_mfcc_do (aubio_mfcc_t * mf, const cvec_t * in, fvec_t * out); 75 75 76 /** set power parameter 77 78 \param mf mfcc object, as returned by new_aubio_mfcc() 79 \param power Raise norm of the input spectrum norm to this power before 80 computing filterbank. Defaults to `1`. 81 82 See aubio_filterbank_set_power(). 83 84 */ 85 uint_t aubio_mfcc_set_power (aubio_mfcc_t *mf, smpl_t power); 86 87 /** get power parameter 88 89 \param mf mfcc object, as returned by new_aubio_mfcc() 90 \return current power parameter. Defaults to `1`. 91 92 See aubio_filterbank_get_power(). 93 94 */ 95 uint_t aubio_mfcc_get_power (aubio_mfcc_t *mf); 96 97 /** set scaling parameter 98 99 \param mf mfcc object, as returned by new_aubio_mfcc() 100 \param scale Scaling value to apply. 101 102 Scales the output of the filterbank after taking its logarithm and before 103 computing the DCT. Defaults to `1`. 104 105 */ 106 uint_t aubio_mfcc_set_scale (aubio_mfcc_t *mf, smpl_t scale); 107 108 /** get scaling parameter 109 110 \param mf mfcc object, as returned by new_aubio_mfcc() 111 \return current scaling parameter. Defaults to `1`. 112 113 */ 114 uint_t aubio_mfcc_get_scale (aubio_mfcc_t *mf); 115 116 /** Mel filterbank initialization 117 118 \param mf mfcc object 119 \param fmin start frequency, in Hz 120 \param fmax end frequency, in Hz 121 122 The filterbank will be initialized with bands linearly spaced in the mel 123 scale, from `fmin` to `fmax`. 124 125 See also 126 -------- 127 128 aubio_filterbank_set_mel_coeffs() 129 130 */ 131 uint_t aubio_mfcc_set_mel_coeffs (aubio_mfcc_t *mf, 132 smpl_t fmin, smpl_t fmax); 133 134 /** Mel filterbank initialization 135 136 \param mf mfcc object 137 \param fmin start frequency, in Hz 138 \param fmax end frequency, in Hz 139 140 The bank of filters will be initalized to to cover linearly spaced bands in 141 the Htk mel scale, from `fmin` to `fmax`. 142 143 See also 144 -------- 145 146 aubio_filterbank_set_mel_coeffs_htk() 147 148 */ 149 uint_t aubio_mfcc_set_mel_coeffs_htk (aubio_mfcc_t *mf, 150 smpl_t fmin, smpl_t fmax); 151 152 /** Mel filterbank initialization (Auditory Toolbox's parameters) 153 154 \param mf mfcc object 155 \param samplerate audio sampling rate, in Hz 156 157 The filter coefficients are built to match exactly Malcolm Slaney's Auditory 158 Toolbox implementation. The number of filters should be 40. 159 160 This is the default filterbank when `mf` was created with `n_filters = 40`. 161 162 See also 163 -------- 164 165 aubio_filterbank_set_mel_coeffs_slaney() 166 167 */ 168 uint_t aubio_mfcc_set_mel_coeffs_slaney (aubio_mfcc_t *mf); 169 76 170 #ifdef __cplusplus 77 171 }
Note: See TracChangeset
for help on using the changeset viewer.