source: tests/python/examples/aubioonset.py @ 0f2084d

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

simplified examples template

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[031b1f9]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()
[9f9f63f]12    assert len(str(self.output)) != 0, "no output produced with command:\n" \
13      + self.command
[031b1f9]14
15  def test_aubioonset_with_inf_silence(self):
16    """ test aubioonset with -s 0  """
17    self.command += " -s 0" 
18    self.getOutput()
19    assert len(self.output) == 0, self.output
20
21  def test_aubioonset_with_no_silence(self):
22    """ test aubioonset with -s -100 """ 
23    self.command += " -s -100 " 
24    self.getOutput()
25    # only one onset in woodblock.aiff
[9f9f63f]26    assert len(str(self.output)) != 0, "no output produced with command:\n" \
27      + self.command
[100f950]28    assert len(self.output.split('\n')) == 1
[031b1f9]29    # onset should be at 0.00000
30    assert float(self.output.strip()) == 0.
31
[100f950]32for name in ["energy", "specdiff", "hfc", "complex", "phase", "kl", "mkl"]:
33  exec("class aubioonset_test_case_"+name+"(aubioonset_test_case):\n\
34  options = \" -O "+name+" \"")
[9f9f63f]35
[100f950]36if __name__ == '__main__': unittest.main()
Note: See TracBrowser for help on using the repository browser.