History

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

Paul Brossier committed 20 years ago

Commit 99d27b71 parent d9981903 files · +14 −0Browse files

Showing the changes to python/test/bench (2 of 3 files). Show all

Unified · Split

2 files
  1. python/test/bench/pitch/Makefile.am +13 −0
  2. python/test/bench/pitch/bench-pitch +49 −0
python/test/bench/pitch/Makefile.am+13−0
@@ -0,0 +1,13 @@
1+export BASEDIR=../../../..
2+export PYTHONPATH=$(BASEDIR)/python
3+export LD_LIBRARY_PATH=$(BASEDIR)/src/.libs:$(BASEDIR)/ext/.libs
4+
5+SOURCE = \
6+ /archives/samples/pitch/isolated
7+
8+test-aubiopitch: $(patsubst %, %.aubiopitch, $(SOURCE))
9+
10+%.aubiopitch: %
11+ rm -f `basename $<`.aubiocut
12+ ./bench-pitch $< #| tee `basename $<`.aubiocut
13+ #diff `basename $<`.aubiocut.ref `basename $<`.aubiocut
python/test/bench/pitch/bench-pitch+49−0
@@ -0,0 +1,49 @@
1+#! /usr/bin/python
2+
3+from aubio.bench.node import *
4+from aubio.tasks import *
5+
6+class benchpitch(bench):
7+
8+ def file_exec(self,input,output):
9+ filetask = self.task(input,params=self.params)
10+ computed_data = filetask.compute_all()
11+ results = filetask.eval(computed_data)
12+ self.results.append(results)
13+ truth = filetask.gettruth()
14+ #print input, results, results - float(input.split('.')[-2])
15+ self.pretty_print((self.params.pitchmode, truth,
16+ truth - results[0], results[0],
17+ truth - results[1], results[1]))
18+
19+ def run_bench(self,modes=['schmitt']):
20+ self.modes = modes
21+ self.pretty_print(self.titles)
22+ for mode in self.modes:
23+ self.params.pitchmode = mode
24+ self.dir_exec()
25+ self.dir_eval()
26+ self.dir_plot()
27+
28+if __name__ == "__main__":
29+ import sys
30+ if len(sys.argv) > 1: datapath = sys.argv[1]
31+ else: print "error: a path is required"; sys.exit(1)
32+ if len(sys.argv) > 2:
33+ for each in sys.argv[3:-1]: print each
34+ modes = ['yin', 'schmitt', 'mcomb', 'fcomb']
35+
36+ benchpitch = benchpitch(datapath)
37+ benchpitch.params = taskparams()
38+ benchpitch.task = taskpitch
39+
40+
41+ benchpitch.titles = [ 'mode', 'thres', 'avg', 'avgdist' ]
42+ benchpitch.formats = ["%12s" , "| %6s", "| %6s", "| %6s", "| %6s", "| %6s" ]
43+ try:
44+ benchpitch.run_bench(modes=modes)
45+ except KeyboardInterrupt:
46+ print "Interrupted by user"
47+ sys.exit(1)
48+
49+ sys.exit(0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t