source: python/bench-pitch @ 660c1d82

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 660c1d82 was 4f4a8a4, checked in by Paul Brossier <piem@altern.org>, 19 years ago

move to new nodes and tasks
move to new nodes and tasks

  • Property mode set to 100755
File size: 1.3 KB
Line 
1#! /usr/bin/python
2
3from aubio.bench.node import *
4from aubio.tasks import *
5
6class benchpitch(bench):
7       
8        def file_exec(self,input,output):
9                filetask = self.task(input,params=self.params)
10                computed_data = filetask.compute_all()
11                results = filetask.eval(computed_data)
12                self.results.append(results)
13                truth = filetask.gettruth()
14                #print input, results, results - float(input.split('.')[-2])
15                self.pretty_print((self.params.pitchmode, truth,
16                        truth - results[0], results[0],
17                        truth - results[1], results[1]))
18                       
19        def run_bench(self,modes=['schmitt']):
20                self.modes = modes
21                self.pretty_print(self.titles)
22                for mode in self.modes:
23                        self.params.pitchmode = mode
24                        self.dir_exec()
25                        self.dir_eval()
26                        self.dir_plot()
27
28if __name__ == "__main__":
29        import sys
30        if len(sys.argv) > 1: datapath = sys.argv[1]
31        else: print "error: a path is required"; sys.exit(1)
32        if len(sys.argv) > 2:
33                for each in sys.argv[3:-1]: print each
34        modes = ['yin', 'schmitt', 'mcomb', 'fcomb']
35
36        benchpitch = benchpitch(datapath)
37        benchpitch.params = taskparams()
38        benchpitch.task = taskpitch
39
40
41        benchpitch.titles  = [ 'mode', 'thres', 'avg', 'avgdist' ]
42        benchpitch.formats = ["%12s" , "| %6s", "| %6s", "| %6s", "| %6s", "| %6s" ]
43        try:
44                benchpitch.run_bench(modes=modes)
45        except KeyboardInterrupt:
46                print "Interrupted by user"
47                sys.exit(1)
48
49        sys.exit(0)
Note: See TracBrowser for help on using the repository browser.