add Makefile for bench-pitch
authorPaul Brossier <piem@altern.org>
Fri, 17 Feb 2006 17:42:04 +0000 (17:42 +0000)
committerPaul Brossier <piem@altern.org>
Fri, 17 Feb 2006 17:42:04 +0000 (17:42 +0000)
add Makefile for bench-pitch

configure.ac
python/bench-pitch [deleted file]
python/test/bench/pitch/Makefile.am [new file with mode: 0644]
python/test/bench/pitch/bench-pitch [new file with mode: 0755]

index 2cce646..e266e8b 100644 (file)
@@ -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 (executable)
index b38b068..0000000
+++ /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 (file)
index 0000000..cbd4035
--- /dev/null
@@ -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 (executable)
index 0000000..b38b068
--- /dev/null
@@ -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)