source: tests/python/src/temporal/adesign.py @ 7e204d01

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 7e204d01 was 6913434, checked in by Paul Brossier <piem@piem.org>, 17 years ago

add tests for adesign and filter

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[6913434]1from template import aubio_unit_template
2from aubio.aubiowrapper import *
3
4samplerate = 44100
5buf_size = 1024
6channels = 2
7
8class adsgn_filter_unit(aubio_unit_template):
9
10  def setUp(self):
11    self.o = new_aubio_adsgn_filter(samplerate, channels)
12
13  def tearDown(self):
14    del_aubio_adsgn_filter(self.o)
15
16  def test_creation(self):
17    pass
18
19  def test_filter_zeroes(self):
20    """ check filter run on a vector full of zeroes returns zeros """
21    vec = new_fvec(buf_size, channels)
22    aubio_adsgn_filter_do(self.o, vec)
23    for index in range(buf_size):
24      for channel in range(channels):
25        self.assertEqual(0., fvec_read_sample(vec,channel,index))
26    del_fvec(vec)
27
28  def test_filter_ones(self):
29    vec = new_fvec(buf_size, channels)
30    for index in range(buf_size):
31      for channel in range(channels):
32        fvec_write_sample(vec, 1., channel, index)
33    aubio_adsgn_filter_do(self.o, vec)
34    for index in range(buf_size):
35      for channel in range(channels):
36        self.assertNotEqual(0., fvec_read_sample(vec,channel,index))
37    del_fvec(vec)
38
39  def test_filter_denormal(self):
40    vec = new_fvec(buf_size, channels)
41    for index in range(buf_size):
42      for channel in range(channels):
43        fvec_write_sample(vec, 1.e-37, channel, index)
44    aubio_adsgn_filter_do(self.o, vec)
45    for index in range(buf_size):
46      for channel in range(channels):
47        self.assertEqual(0., fvec_read_sample(vec,channel,index))
48    del_fvec(vec)
49
50if __name__ == '__main__':
51  unittest.main()
Note: See TracBrowser for help on using the repository browser.