ref: 2672d67e4243a791b84fd6825d965ad38a9f651c
parent: f603b5758565757dc0969b563767c6c5f662fb54
author: Paul Brossier <piem@piem.org>
date: Wed Oct 7 22:13:38 EDT 2009
tests/python/src/temporal/: update a_weighting tests
--- a/tests/python/src/temporal/a_weighting.py
+++ b/tests/python/src/temporal/a_weighting.py
@@ -2,9 +2,9 @@
samplerate = 44100
buf_size = 1024
-channels = 2
+channels = 1
-class adsgn_filter_unit(aubio_unit_template):
+class a_weighting_unit (aubio_unit_template):
def setUp(self):
self.o = new_aubio_filter_a_weighting (samplerate, channels)
@@ -45,6 +45,22 @@
for channel in range(channels):
self.assertEqual(0., fvec_read_sample(vec,channel,index))
del_fvec(vec)
+
+ def test_simple(self):
+ buf_size = 32
+ input = new_fvec (buf_size, 1)
+ output = new_fvec (buf_size, 1)
+ expected = array_from_text_file('src/temporal/a_weighting_test_simple.expected')
+ fvec_write_sample (input, 0.5, 0, 12)
+ for i in range(buf_size):
+ for c in range(channels):
+ self.assertEqual(expected[0][i], fvec_read_sample(input, c, i))
+ f = new_aubio_filter_a_weighting (samplerate, channels)
+ aubio_filter_do_outplace (f, input, output)
+ del_aubio_filter (f)
+ for i in range(buf_size):
+ for c in range(channels):
+ self.assertCloseEnough(expected[1][i], fvec_read_sample(output, c, i))
if __name__ == '__main__':
import unittest
--- /dev/null
+++ b/tests/python/src/temporal/a_weighting_test_simple.expected
@@ -1,0 +1,2 @@
+ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 5.00000000e-01 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
+ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 1.27870563e-01 2.58244342e-01 1.18719361e-01 -4.02623805e-02 -5.61812129e-02 -5.24739734e-02 -4.72329276e-02 -4.23394349e-02 -3.79219586e-02 -3.39473148e-02 -3.03724479e-02 -2.71574847e-02 -2.42664433e-02 -2.16669285e-02 -1.93297810e-02 -1.72287543e-02 -1.53402241e-02 -1.36429261e-02 -1.21177207e-02 -1.07473802e-02