shithub: aubio

Download patch

ref: 98c712ebf731a23b5252162007289809c637f431
parent: bc1ed6368f0057be27c5aea0267e94f79884acea
author: Paul Brossier <piem@piem.org>
date: Fri Nov 9 12:30:38 EST 2018

[tests] set_triangle_bands should when list starts with 0 (see #206)

--- a/python/tests/test_filterbank_mel.py
+++ b/python/tests/test_filterbank_mel.py
@@ -47,6 +47,15 @@
                 [ 0.02070313, 0.02138672, 0.02127604, 0.02135417,
                     0.02133301, 0.02133301, 0.02133311, 0.02133334, 0.02133345])
 
+    def test_triangle_freqs_with_zeros(self):
+        """make sure set_triangle_bands works when list starts with 0"""
+        freq_list = [0, 40, 80]
+        freqs = np.array(freq_list, dtype = float_type)
+        f = filterbank(len(freqs)-2, 1024)
+        f.set_triangle_bands(freqs, 48000)
+        assert_equal ( f(cvec(1024)), 0)
+        self.assertIsInstance(f.get_coeffs(), np.ndarray)
+
 if __name__ == '__main__':
     import nose2
     nose2.main()