source: python/test/bench/onset/bench-window @ 83c6734

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

added bench-window, bench-delay, benchonset
added bench-window, bench-delay, benchonset

  • Property mode set to 100755
File size: 1.7 KB
Line 
1#! /usr/bin/python
2
3from aubio.tasks import *
4
5from benchonset import mmean, stdev, plotdiffs, plotplotdiffs, benchonset
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                for mode in modes:
14
15                        self.params.onsetmode = mode
16                        self.params.threshold = thresholds[0]
17                        self.params.localmin = False
18
19                        for delay in (0., 4.):
20                                d = []
21                                outplot = "_-_".join(("window",mode,"delay-%s" % delay,
22                                        basename(self.datadir) ))
23                                self.params.delay = delay
24
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
31                                                self.dir_exec()
32                                                self.dir_eval()
33                                                self.pretty_print()
34                                                plotdiffs(self.v,d,plottitle="%s %s" % (buf,hop))
35
36                                plotplotdiffs(d)
37                                plotplotdiffs(d,outplot=outplot,extension="png")
38                                plotplotdiffs(d,outplot=outplot,extension="ps")
39                                plotplotdiffs(d,outplot=outplot,extension="svg")
40
41
42if __name__ == "__main__":
43        import sys
44        if len(sys.argv) > 1: datapath = sys.argv[1]
45        else: print "ERR: a path is required"; sys.exit(1)
46        modes = ['complex', 'energy', 'phase', 'specdiff', 'kl', 'mkl', 'dual']
47        #modes = [ 'complex' ]
48        thresholds = [ 0.5]
49        #thresholds = [1.5]
50
51        #datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
52        respath = '/var/tmp/DB-testings'
53
54        benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
55        benchonset.params = taskparams()
56        benchonset.task = taskonset
57        benchonset.valuesdict = {}
58
59        try:
60                #benchonset.auto_learn2(modes=modes)
61                benchonset.run_bench(modes=modes,thresholds=thresholds)
62        except KeyboardInterrupt:
63                sys.exit(1)
Note: See TracBrowser for help on using the repository browser.