source: tests/demo/bench/onset/bench-window @ c342c17

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

move tests/python/demo to tests/, add localaubio.py module helpers

  • Property mode set to 100755
File size: 1.8 KB
Line 
1#! /usr/bin/python
2
3from aubio.bench.onset import benchonset
4from aubio.task.onset import taskonset
5from aubio.task.params import taskparams
6
7class mybenchonset(benchonset):
8
9        def run_bench(self,modes=['dual'],thresholds=[0.5]):
10                from os.path import dirname,basename
11                self.thresholds = thresholds
12                self.pretty_titles()
13
14                for mode in modes:
15
16                        self.params.onsetmode = mode
17                        self.params.localmin = True
18                        self.params.delay = 1.
19                        self.params.threshold = thresholds[0]
20                        self.params.localmin = False
21                        #
22                        for delay in (0., 4.):
23                                d = []
24                                self.params.delay = delay
25                                for buf in (2048, 1024, 512):
26                                        for hop in (buf/2, buf/4):
27                                                self.params.bufsize = buf
28                                                self.params.hopsize = hop
29                                                self.params.step = float(self.params.hopsize)/float(self.params.samplerate)
30                                                self.dir_eval_print()
31                                                self.plotdiffs(d,plottitle="%s %s" % (buf,hop))
32                                #plotplotdiffs(d)
33                                outplot = "_-_".join(("window",mode,"delay-%s" % int(delay),
34                                        basename(self.datadir) ))
35                                for ext in ("png","svg","ps"):
36                                        self.plotplotdiffs(d,outplot=outplot,extension=ext)
37
38if __name__ == "__main__":
39        import sys
40        if len(sys.argv) > 1: datapath = sys.argv[1]
41        else: print "ERR: a path is required"; sys.exit(1)
42        modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual']
43        #thresholds = [ 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2]
44        #modes = [ 'hfc' ]
45        thresholds = [0.5]
46
47        #datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
48        respath = '/var/tmp/DB-testings'
49
50        benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
51        benchonset.params = taskparams()
52        benchonset.task = taskonset
53        benchonset.valuesdict = {}
54
55        try:
56                #benchonset.auto_learn2(modes=modes)
57                benchonset.run_bench(modes=modes,thresholds=thresholds)
58        except KeyboardInterrupt:
59                sys.exit(1)
Note: See TracBrowser for help on using the repository browser.