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)
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
unittest.main()
--- /dev/null
+ 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