ref: 0316feb35fa29adc9c1f035d56d5b500e1be3626
parent: 992e0ffb7278984d985b43f0638b3de72fdc7a87
author: Paul Brossier <piem@piem.org>
date: Sat Nov 17 08:24:48 EST 2018
[filterbank] check input samplerate, not n_bands
--- a/src/spectral/filterbank_mel.c
+++ b/src/spectral/filterbank_mel.c
@@ -219,6 +219,10 @@
fmat_t *coeffs = aubio_filterbank_get_coeffs(fb);
uint_t n_bands = coeffs->height;
+ if (samplerate <= 0) {
+ AUBIO_ERR("filterbank: set_mel_coeffs samplerate should be > 0\n");
+ return AUBIO_FAIL;
+ }
if (freq_max < 0) {
AUBIO_ERR("filterbank: set_mel_coeffs freq_max should be > 0\n");
return AUBIO_FAIL;
@@ -233,10 +237,6 @@
} else {
start = aubio_hztomel(freq_min);
}
- if (n_bands <= 0) {
- AUBIO_ERR("filterbank: set_mel_coeffs n_bands should be > 0\n");
- return AUBIO_FAIL;
- }
freqs = new_fvec(n_bands + 2);
step = (end - start) / (n_bands + 1);
@@ -263,6 +263,10 @@
fmat_t *coeffs = aubio_filterbank_get_coeffs(fb);
uint_t n_bands = coeffs->height;
+ if (samplerate <= 0) {
+ AUBIO_ERR("filterbank: set_mel_coeffs samplerate should be > 0\n");
+ return AUBIO_FAIL;
+ }
if (freq_max < 0) {
AUBIO_ERR("filterbank: set_mel_coeffs freq_max should be > 0\n");
return AUBIO_FAIL;
@@ -276,10 +280,6 @@
return AUBIO_FAIL;
} else {
start = aubio_hztomel_htk(freq_min);
- }
- if (n_bands <= 0) {
- AUBIO_ERR("filterbank: set_mel_coeffs n_bands should be > 0\n");
- return AUBIO_FAIL;
}
freqs = new_fvec (n_bands + 2);