shithub: aubio

Download patch

ref: 69dbe0a2be9a1781575de5413755e86a0619ff0b
parent: f6bfc261fff914a8ff58152fab64a8f3bda68323
author: Paul Brossier <piem@piem.org>
date: Sat Nov 17 09:14:41 EST 2018

[filterbank] check samplerate in _slaney, use temp variables

--- a/src/spectral/filterbank_mel.c
+++ b/src/spectral/filterbank_mel.c
@@ -172,6 +172,11 @@
 {
   uint_t retval;
 
+  if (samplerate <= 0) {
+    AUBIO_ERR("filterbank: set_mel_coeffs_slaney samplerate should be > 0\n");
+    return AUBIO_FAIL;
+  }
+
   /* Malcolm Slaney parameters */
   smpl_t lowestFrequency = 133.3333;
   smpl_t linearSpacing = 66.66666666;
@@ -239,7 +244,7 @@
   fmat_t *coeffs = aubio_filterbank_get_coeffs(fb);
   uint_t n_bands = coeffs->height;
 
-  if (aubio_filterbank_check_freqs(fb, samplerate, &freq_min, &freq_max)) {
+  if (aubio_filterbank_check_freqs(fb, samplerate, &start, &end)) {
     return AUBIO_FAIL;
   }
 
@@ -271,7 +276,7 @@
   fmat_t *coeffs = aubio_filterbank_get_coeffs(fb);
   uint_t n_bands = coeffs->height;
 
-  if (aubio_filterbank_check_freqs(fb, samplerate, &freq_min, &freq_max)) {
+  if (aubio_filterbank_check_freqs(fb, samplerate, &start, &end)) {
     return AUBIO_FAIL;
   }