shithub: aubio

Download patch

ref: 99d27b7be002e2ef4fde2f09e341584f1968bb48
parent: d998190e422036f80ffb1dac9c5ba1a16ed4bb51
author: Paul Brossier <[email protected]>
date: Fri Feb 17 12:42:04 EST 2006

add Makefile for bench-pitch
add Makefile for bench-pitch


--- a/configure.ac
+++ b/configure.ac
@@ -230,6 +230,7 @@
 		plugins/wavesurfer/Makefile
                 plugins/puredata/Makefile
                 python/test/bench/onset/Makefile
+                python/test/bench/pitch/Makefile
                 doc/Makefile
 	])
 
--- a/python/bench-pitch
+++ /dev/null
@@ -1,49 +1,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)
--- /dev/null
+++ b/python/test/bench/pitch/Makefile.am
@@ -1,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
--- /dev/null
+++ b/python/test/bench/pitch/bench-pitch
@@ -1,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)