source: tests/python/examples/aubioonset.py @ 9f9f63f

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

aubioonset test: make sure default parameters detect the woodblock

  • Property mode set to 100644
File size: 2.1 KB
Line 
1from template import *
2
3class aubioonset_test_case(program_test_case):
4 
5  import os.path
6  filename = os.path.join('..','..','sounds','woodblock.aiff')
7  progname = os.path.join('..','..','examples','aubioonset')
8
9  def test_aubioonset(self):
10    """ test aubioonset with default parameters """
11    self.getOutput()
12    assert len(self.output) != 0, self.output
13    assert len(str(self.output)) != 0, "no output produced with command:\n" \
14      + self.command
15
16  def test_aubioonset_with_inf_silence(self):
17    """ test aubioonset with -s 0  """
18    self.command += " -s 0" 
19    self.getOutput()
20    assert len(self.output) == 0, self.output
21
22  def test_aubioonset_with_no_silence(self):
23    """ test aubioonset with -s -100 """ 
24    self.command += " -s -100 " 
25    self.getOutput()
26    # only one onset in woodblock.aiff
27    assert len(self.output.split('\n')) == 1
28    assert len(str(self.output)) != 0, "no output produced with command:\n" \
29      + self.command
30    # onset should be at 0.00000
31    assert float(self.output.strip()) == 0.
32
33class aubioonset_test_case_energy(aubioonset_test_case):
34  def setUp(self, options = " -O energy "):
35    aubioonset_test_case.setUp(self, options = options)
36
37class aubioonset_test_case_specdiff(aubioonset_test_case):
38  def setUp(self, options = " -O specdiff "):
39    aubioonset_test_case.setUp(self, options = options)
40
41class aubioonset_test_case_hfc(aubioonset_test_case):
42  def setUp(self, options = " -O hfc "):
43    aubioonset_test_case.setUp(self, options = options)
44
45class aubioonset_test_case_complex(aubioonset_test_case):
46  def setUp(self, options = " -O complex "):
47    aubioonset_test_case.setUp(self, options = options)
48
49class aubioonset_test_case_phase(aubioonset_test_case):
50  def setUp(self, options = " -O phase"):
51    aubioonset_test_case.setUp(self, options = options)
52
53class aubioonset_test_case_kl(aubioonset_test_case):
54  def setUp(self, options = " -O kl "):
55    aubioonset_test_case.setUp(self, options = options)
56
57class aubioonset_test_case_mkl(aubioonset_test_case):
58  def setUp(self, options = " -O mkl "):
59    aubioonset_test_case.setUp(self, options = options)
60
61if __name__ == '__main__':
62
63  unittest.main()
Note: See TracBrowser for help on using the repository browser.