ref: 965ea78a7a4aefa68e54f7c108e635740ed8b0fb
dir: /tests/demo/bench/onset/bench-delay/
#! /usr/bin/python from aubio.bench.onset import benchonset from aubio.task.onset import taskonset from aubio.task.params import taskparams class mybenchonset(benchonset): def run_bench(self,modes=['dual'],thresholds=[0.5]): from os.path import dirname,basename self.thresholds = thresholds self.pretty_titles() for mode in modes: d = [] self.params.onsetmode = mode self.params.localmin = True self.params.delay = 1. self.params.threshold = thresholds[0] # self.params.localmin = False self.params.delay = 0. self.dir_eval_print() self.plotdiffs(d,plottitle="Causal") # self.params.localmin = True self.params.delay = 0. self.dir_eval_print() self.plotdiffs(d,plottitle="Local min") self.params.localmin = False self.params.delay = 6. self.dir_eval_print() self.plotdiffs(d,plottitle="Fixed delay") #self.plotplotdiffs(d) outplot = "_-_".join(("delay",mode,basename(self.datadir) )) for ext in ("png","svg","ps"): self.plotplotdiffs(d,outplot=outplot,extension=ext) if __name__ == "__main__": import sys if len(sys.argv) > 1: datapath = sys.argv[1] else: print "ERR: a path is required"; sys.exit(1) modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual'] #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] #modes = [ 'hfc' ] thresholds = [0.5] #datapath = "%s%s" % (DATADIR,'/onset/DB/*/') respath = '/var/tmp/DB-testings' benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True) benchonset.params = taskparams() benchonset.task = taskonset benchonset.valuesdict = {} try: #benchonset.auto_learn2(modes=modes) benchonset.run_bench(modes=modes,thresholds=thresholds) except KeyboardInterrupt: sys.exit(1)