From: Paul Brossier Date: Fri, 17 Feb 2006 17:42:04 +0000 (+0000) Subject: add Makefile for bench-pitch X-Git-Tag: 0.4.0-beta1~1298 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=99d27b7be002e2ef4fde2f09e341584f1968bb48;p=aubio.git add Makefile for bench-pitch add Makefile for bench-pitch --- diff --git a/configure.ac b/configure.ac index 2cce6463..e266e8b8 100644 --- a/configure.ac +++ b/configure.ac @@ -230,6 +230,7 @@ AC_OUTPUT([ plugins/wavesurfer/Makefile plugins/puredata/Makefile python/test/bench/onset/Makefile + python/test/bench/pitch/Makefile doc/Makefile ]) diff --git a/python/bench-pitch b/python/bench-pitch deleted file mode 100755 index b38b068e..00000000 --- a/python/bench-pitch +++ /dev/null @@ -1,49 +0,0 @@ -#! /usr/bin/python - -from aubio.bench.node import * -from aubio.tasks import * - -class benchpitch(bench): - - def file_exec(self,input,output): - filetask = self.task(input,params=self.params) - computed_data = filetask.compute_all() - results = filetask.eval(computed_data) - self.results.append(results) - truth = filetask.gettruth() - #print input, results, results - float(input.split('.')[-2]) - self.pretty_print((self.params.pitchmode, truth, - truth - results[0], results[0], - truth - results[1], results[1])) - - def run_bench(self,modes=['schmitt']): - self.modes = modes - self.pretty_print(self.titles) - for mode in self.modes: - self.params.pitchmode = mode - self.dir_exec() - self.dir_eval() - self.dir_plot() - -if __name__ == "__main__": - import sys - if len(sys.argv) > 1: datapath = sys.argv[1] - else: print "error: a path is required"; sys.exit(1) - if len(sys.argv) > 2: - for each in sys.argv[3:-1]: print each - modes = ['yin', 'schmitt', 'mcomb', 'fcomb'] - - benchpitch = benchpitch(datapath) - benchpitch.params = taskparams() - benchpitch.task = taskpitch - - - benchpitch.titles = [ 'mode', 'thres', 'avg', 'avgdist' ] - benchpitch.formats = ["%12s" , "| %6s", "| %6s", "| %6s", "| %6s", "| %6s" ] - try: - benchpitch.run_bench(modes=modes) - except KeyboardInterrupt: - print "Interrupted by user" - sys.exit(1) - - sys.exit(0) diff --git a/python/test/bench/pitch/Makefile.am b/python/test/bench/pitch/Makefile.am new file mode 100644 index 00000000..cbd40350 --- /dev/null +++ b/python/test/bench/pitch/Makefile.am @@ -0,0 +1,13 @@ +export BASEDIR=../../../.. +export PYTHONPATH=$(BASEDIR)/python +export LD_LIBRARY_PATH=$(BASEDIR)/src/.libs:$(BASEDIR)/ext/.libs + +SOURCE = \ + /archives/samples/pitch/isolated + +test-aubiopitch: $(patsubst %, %.aubiopitch, $(SOURCE)) + +%.aubiopitch: % + rm -f `basename $<`.aubiocut + ./bench-pitch $< #| tee `basename $<`.aubiocut + #diff `basename $<`.aubiocut.ref `basename $<`.aubiocut diff --git a/python/test/bench/pitch/bench-pitch b/python/test/bench/pitch/bench-pitch new file mode 100755 index 00000000..b38b068e --- /dev/null +++ b/python/test/bench/pitch/bench-pitch @@ -0,0 +1,49 @@ +#! /usr/bin/python + +from aubio.bench.node import * +from aubio.tasks import * + +class benchpitch(bench): + + def file_exec(self,input,output): + filetask = self.task(input,params=self.params) + computed_data = filetask.compute_all() + results = filetask.eval(computed_data) + self.results.append(results) + truth = filetask.gettruth() + #print input, results, results - float(input.split('.')[-2]) + self.pretty_print((self.params.pitchmode, truth, + truth - results[0], results[0], + truth - results[1], results[1])) + + def run_bench(self,modes=['schmitt']): + self.modes = modes + self.pretty_print(self.titles) + for mode in self.modes: + self.params.pitchmode = mode + self.dir_exec() + self.dir_eval() + self.dir_plot() + +if __name__ == "__main__": + import sys + if len(sys.argv) > 1: datapath = sys.argv[1] + else: print "error: a path is required"; sys.exit(1) + if len(sys.argv) > 2: + for each in sys.argv[3:-1]: print each + modes = ['yin', 'schmitt', 'mcomb', 'fcomb'] + + benchpitch = benchpitch(datapath) + benchpitch.params = taskparams() + benchpitch.task = taskpitch + + + benchpitch.titles = [ 'mode', 'thres', 'avg', 'avgdist' ] + benchpitch.formats = ["%12s" , "| %6s", "| %6s", "| %6s", "| %6s", "| %6s" ] + try: + benchpitch.run_bench(modes=modes) + except KeyboardInterrupt: + print "Interrupted by user" + sys.exit(1) + + sys.exit(0)