shithub: aubio

Download patch

ref: b554e41cfcf7d581dc3296f09dc846e5ffc65049
parent: a1da37faa83d6da7192c13e291fabdbc171ba447
author: Paul Brossier <[email protected]>
date: Sat Feb 9 15:03:21 EST 2013

moved out old python interface

--- /dev/null
+++ b/python.old/README
@@ -1,0 +1,30 @@
+# Here you will find some examples of python scripts and some evaluation
+# routines. The python interface for libaubio is generated using Swig.
+
+# To have it working before installation, you will need to set LD_LIBRARY_PATH.
+# for instance, to run the python script from within aubio/python/, you can use
+# '. README'
+
+export LD_LIBRARY_PATH=../src/.libs:../ext/.libs
+export PYTHONPATH=aubio/.libs
+
+echo """
+
+the aubio/ directory should be organised as follow:
+
+ aubiowrapper.py,_aubiowrapper.so, aubio_wrap.c, aubio_wrap.o
+ 	swig generated aubio interface 
+ aubioclass.py
+ 	human usable interface
+ plot/
+ 	everything required to plot
+ web/
+ 	tools to use aubioweb.py
+ bench/
+ 	tools to explore a database of sound file and run benchmarks on it
+ eval/
+ 	tools to evaluate the performance of aubio extractors
+ aubioweb.py
+ 	a hack to pipe aubio in mod_python
+ 
+"""
--- /dev/null
+++ b/python.old/aubio/__init__.py
@@ -1,0 +1,28 @@
+"""Copyright (C) 2004 Paul Brossier <[email protected]>
+print aubio.__LICENSE__ for the terms of use
+"""
+
+__LICENSE__ = """\
+  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
+
+  This file is part of aubio.
+
+  aubio is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  aubio is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
+"""            
+
+#from aubioclass import *
+#from onsetcompare import *
+#from median import *
+#from noteroc import *
+#from txtfile import *
--- /dev/null
+++ b/python.old/aubio/aubioclass.py
@@ -1,0 +1,160 @@
+from aubiowrapper import *
+
+class fvec:
+    def __init__(self,size):
+        self.vec = new_fvec(size)
+    def __call__(self):
+        return self.vec
+    def __del__(self):
+        del_fvec(self())
+    def get(self,pos):
+        return fvec_read_sample(self(),pos)
+    def set(self,value,pos):
+        return fvec_write_sample(self(),value,pos)
+    def data(self):
+        return fvec_get_data(self())
+
+class cvec:
+    def __init__(self,size):
+        self.vec = new_cvec(size)
+    def __call__(self):
+        return self.vec
+    def __del__(self):
+        del_cvec(self())
+    def get(self,pos):
+        return self.get_norm(pos)
+    def set(self,val,pos):
+        self.set_norm(val,pos)
+    def get_norm(self,pos):
+        return cvec_read_norm(self(),pos)
+    def set_norm(self,val,pos):
+        cvec_write_norm(self(),val,pos)
+    def get_phas(self,pos):
+        return cvec_read_phas(self(),pos)
+    def set_phas(self,val,pos):
+        cvec_write_phas(self(),val,pos)
+
+class sndfile:
+    def __init__(self,filename,model=None):
+        if (model!=None):
+            self.file = new_aubio_sndfile_wo(model.file,filename)
+        else:
+            self.file = new_aubio_sndfile_ro(filename)
+        if self.file == None:
+            raise IOError, "failed opening file %s" % filename
+    def __del__(self):
+        if self.file != None: del_aubio_sndfile(self.file)
+    def info(self):
+        aubio_sndfile_info(self.file)
+    def samplerate(self):
+        return aubio_sndfile_samplerate(self.file)
+    def channels(self):
+        return aubio_sndfile_channels(self.file)
+    def read(self,nfram,vecread):
+        return aubio_sndfile_read_mono(self.file,nfram,vecread())
+    def write(self,nfram,vecwrite):
+        return aubio_sndfile_write(self.file,nfram,vecwrite())
+
+class pvoc:
+    def __init__(self,buf,hop):
+        self.pv = new_aubio_pvoc(buf,hop)
+    def __del__(self):
+        del_aubio_pvoc(self.pv)
+    def do(self,tf,tc):
+        aubio_pvoc_do(self.pv,tf(),tc())
+    def rdo(self,tc,tf):
+        aubio_pvoc_rdo(self.pv,tc(),tf())
+
+class onsetdetection:
+    """ class for aubio_specdesc """
+    def __init__(self,mode,buf):
+        self.od = new_aubio_specdesc(mode,buf)
+    def do(self,tc,tf):
+        aubio_specdesc_do(self.od,tc(),tf())
+    def __del__(self):
+        del_aubio_specdesc(self.od)
+
+class peakpick:
+    """ class for aubio_peakpicker """
+    def __init__(self,threshold=0.1):
+        self.pp = new_aubio_peakpicker()
+        self.out = new_fvec(1)
+        aubio_peakpicker_set_threshold (self.pp, threshold)
+    def do(self,fv):
+        aubio_peakpicker_do(self.pp, fv(), self.out)
+        return fvec_read_sample(self.out, 0)
+    def getval(self):
+        return aubio_peakpicker_get_adaptive_threshold(self.pp)
+    def __del__(self):
+        del_aubio_peakpicker(self.pp)
+
+class onsetpick:
+    """ superclass for aubio_pvoc + aubio_specdesc + aubio_peakpicker """
+    def __init__(self,bufsize,hopsize,myvec,threshold,mode='dual',derivate=False,dcthreshold=0):
+        self.myfft    = cvec(bufsize)
+        self.pv       = pvoc(bufsize,hopsize)
+        if mode in ['dual'] :
+                self.myod     = onsetdetection("hfc",bufsize)
+                self.myod2    = onsetdetection("mkl",bufsize)
+                self.myonset  = fvec(1)
+                self.myonset2 = fvec(1)
+        else: 
+                self.myod     = onsetdetection(mode,bufsize)
+                self.myonset  = fvec(1)
+        self.mode     = mode
+        self.pp       = peakpick(float(threshold))
+        self.derivate = derivate
+        self.dcthreshold = dcthreshold 
+        self.oldval   = 0.
+
+    def do(self,myvec): 
+        self.pv.do(myvec,self.myfft)
+        self.myod.do(self.myfft,self.myonset)
+        if self.mode == 'dual':
+           self.myod2.do(self.myfft,self.myonset2)
+           self.myonset.set(self.myonset.get(0)*self.myonset2.get(0),0)
+        if self.derivate:
+           val         = self.myonset.get(0)
+           dval        = val - self.oldval
+           self.oldval = val
+           if dval > 0: self.myonset.set(dval,0)
+           else:  self.myonset.set(0.,0,0)
+        isonset, dval = self.pp.do(self.myonset),self.myonset.get(0)
+        if self.dcthreshold:
+           if dval < self.dcthreshold: isonset = 0 
+        return isonset, dval
+
+class pitch:
+    def __init__(self,mode="mcomb",bufsize=2048,hopsize=1024,
+        samplerate=44100.,omode="freq",tolerance=0.1):
+        self.pitchp = new_aubio_pitch(mode,bufsize,hopsize,
+            samplerate)
+        self.mypitch = fvec(1)
+        aubio_pitch_set_unit(self.pitchp,omode)
+        aubio_pitch_set_tolerance(self.pitchp,tolerance)
+        #self.filt     = filter(srate,"adsgn")
+    def __del__(self):
+        del_aubio_pitch(self.pitchp)
+    def __call__(self,myvec): 
+        aubio_pitch_do(self.pitchp,myvec(), self.mypitch())
+        return self.mypitch.get(0)
+
+class filter:
+    def __init__(self,srate,type=None):
+        if (type=="adsgn"):
+            self.filter = new_aubio_adsgn_filter(srate)
+    def __del__(self):
+        #del_aubio_filter(self.filter)
+        pass
+    def __call__(self,myvec):
+        aubio_filter_do(self.filter,myvec())
+
+class beattracking:
+    """ class for aubio_beattracking """
+    def __init__(self,winlen,channels):
+        self.p = new_aubio_beattracking(winlen,channels)
+    def do(self,dfframe,out):
+        return aubio_beattracking_do(self.p,dfframe(),out())
+    def __del__(self):
+        del_aubio_beattracking(self.p)
+
--- /dev/null
+++ b/python.old/aubio/bench/broadcast.py
@@ -1,0 +1,25 @@
+from config import *
+
+class run_broadcast:
+        def __init__(self,command,*args):
+                for host in REMOTEHOSTS:
+                        command(host,args[0],args[1:])
+
+def remote_sync(host,path='',options=''):
+        optstring = ''
+        for i in options:
+                optstring = "%s %s" % (optstring,i)
+        print RSYNC_CMD,optstring,RSYNC_OPT,' --delete', 
+        print '%s%s%s%s%s' % (path,'/ ',host,':',path)
+
+
+def fetch_results(host,path='',options=''):
+        optstring = ''
+        for i in options:
+                optstring = "%s %s" % (optstring,i)
+        print RSYNC_CMD,optstring,RSYNC_OPT,' --update', 
+        print '%s%s%s%s%s' % (host,':',path,'/ ',path)
+
+def remote_queue(host,command,options=''):
+        print 'oarsub -p "hostname = \'',host,'\'',command
+        
--- /dev/null
+++ b/python.old/aubio/bench/config.py
@@ -1,0 +1,22 @@
+
+filefound = 0
+try:
+        filename = "/etc/aubio-bench.conf"
+        execfile(filename)
+        filefound = 1
+except IOError:
+        print "no system wide configuration file found in", filename
+
+try:
+        import os
+        filename = "%s%s%s" % (os.getenv('HOME'),os.sep,".aubio-bench.conf")
+        execfile(filename)
+        filefound = 1
+except IOError:
+        #print "no user configuration file found in", filename
+	pass
+
+if filefound == 0:
+        import sys
+        print "error: no configuration file found at all"
+        sys.exit(1)
--- /dev/null
+++ b/python.old/aubio/bench/node.py
@@ -1,0 +1,224 @@
+from config import *
+import commands,sys
+import re
+
+def runcommand(cmd,debug=0):
+        if VERBOSE >= VERBOSE_CMD or debug: print cmd
+        if debug: return 
+        status, output = commands.getstatusoutput(cmd)
+        if status == 0 or VERBOSE >= VERBOSE_OUT:
+                output = output.split('\n')
+        if VERBOSE >= VERBOSE_OUT: 
+                for i in output: 
+                        if i: print i
+        if not status == 0: 
+                print 'error:',status,output
+                print 'command returning error was',cmd
+                #sys.exit(1)
+	if output == '' or output == ['']: return
+        return output 
+
+def list_files(datapath,filter='f', maxdepth = -1):
+	if not os.path.exists(datapath):
+		print
+		print "ERR: no directory %s were found" % datapath
+		sys.exit(1)
+	if maxdepth >= 0: maxstring = " -maxdepth %d " % maxdepth	
+	else: maxstring = ""
+        cmd = '%s' * 6 % ('find ',datapath,maxstring,' -type ',filter, "| sort -n")
+        return runcommand(cmd)
+
+def list_wav_files(datapath,maxdepth = -1):
+	return list_files(datapath, filter="f -name '*.wav'",maxdepth = maxdepth)
+
+sndfile_filter = "f -name '*.wav' -o -name '*.aif' -o -name '*.aiff'"
+
+def list_snd_files(datapath,maxdepth = -1):
+	return list_files(datapath, filter=sndfile_filter, 
+		maxdepth = maxdepth)
+
+def list_res_files(datapath,maxdepth = -1):
+	return list_files(datapath, filter="f -name '*.txt'", maxdepth = maxdepth)
+
+def list_dirs(datapath):
+	return list_files(datapath, filter="d")
+
+def mkdir(path):
+        cmd = '%s%s' % ('mkdir -p ',path)
+        return runcommand(cmd)
+
+def act_on_data (action,datapath,respath=None,suffix='.txt',filter='f',sub='\.wav$',**keywords):
+        """ execute action(datafile,resfile) on all files in datapath """
+        dirlist = list_files(datapath,filter=filter)
+        if dirlist == ['']: dirlist = []
+        if respath:
+		respath_in_datapath = re.split(datapath, respath,maxsplit=1)[1:]
+        	if(respath_in_datapath and suffix == ''): 
+                	print 'error: respath in datapath and no suffix used'
+        for i in dirlist:
+                j = re.split(datapath, i,maxsplit=1)[1]
+                j = re.sub(sub,'',j)
+                #j = "%s%s%s"%(respath,j,suffix)
+		if respath:
+			j = "%s%s"%(respath,j)
+			if sub != '':
+				j = re.sub(sub,suffix,j)
+			else:
+				j = "%s%s" % (j,suffix)
+                action(i,j,**keywords)
+
+def act_on_results (action,datapath,respath,filter='d'):
+        """ execute action(respath) an all subdirectories in respath """
+        dirlist = list_files(datapath,filter='d')
+        respath_in_datapath = re.split(datapath, respath,maxsplit=1)[1:]
+        if(respath_in_datapath and not filter == 'd' and suffix == ''): 
+                print 'warning: respath is in datapath'
+        for i in dirlist:
+                s = re.split(datapath, i ,maxsplit=1)[1]
+                action("%s%s%s"%(respath,'/',s))
+
+def act_on_files (action,listfiles,listres=None,suffix='.txt',filter='f',sub='\.wav$',**keywords):
+        """ execute action(respath) an all subdirectories in respath """
+        if listres and len(listfiles) <= len(listres): 
+		for i in range(len(listfiles)):
+			action(listfiles[i],listres[i],**keywords)
+        else:
+		for i in listfiles:
+                	action(i,None,**keywords)
+
+class bench:
+	""" class to run benchmarks on directories """
+	def __init__(self,datadir,resdir=None,checkres=False,checkanno=False,params=[]):
+		from aubio.task.params import taskparams
+		self.datadir = datadir
+		# path to write results path to
+		self.resdir = resdir
+		# list of annotation files
+		self.reslist = []
+		# list used to gather results
+		self.results = []
+		if not params: self.params = taskparams()
+		else:          self.params = params
+		print "Checking data directory", self.datadir
+		self.checkdata()
+		if checkanno: self.checkanno()
+		if checkres: self.checkres()
+	
+	def checkdata(self):
+		if os.path.isfile(self.datadir):
+			self.dirlist = os.path.dirname(self.datadir)
+		elif os.path.isdir(self.datadir):
+			self.dirlist = list_dirs(self.datadir)
+		# allow dir* matching through find commands?
+		else:
+			print "ERR: path not understood"
+			sys.exit(1)
+		print "Listing directories in data directory",
+		if self.dirlist:
+			print " (%d elements)" % len(self.dirlist)
+		else:
+			print " (0 elements)"
+			print "ERR: no directory %s were found" % self.datadir
+			sys.exit(1)
+		print "Listing sound files in data directory",
+		self.sndlist = list_snd_files(self.datadir)
+		if self.sndlist:
+			print " (%d elements)" % len(self.sndlist)
+		else:
+			print " (0 elements)"
+			print "ERR: no sound files were found in", self.datadir
+			sys.exit(1)
+	
+	def checkanno(self):
+		print "Listing annotations in data directory",
+		self.reslist = list_res_files(self.datadir)
+		print " (%d elements)" % len(self.reslist)
+		#for each in self.reslist: print each
+		if not self.reslist or len(self.reslist) < len (self.sndlist):
+			print "ERR: not enough annotations"
+			return -1
+		else:
+			print "Found enough annotations"
+	
+	def checkres(self):
+		print "Creating results directory"
+		act_on_results(mkdir,self.datadir,self.resdir,filter='d')
+
+	def pretty_print(self,sep='|'):
+		for i in self.printnames:
+			print self.formats[i] % self.v[i], sep,
+		print
+
+	def pretty_titles(self,sep='|'):
+		for i in self.printnames:
+			print self.formats[i] % i, sep,
+		print
+
+	def dir_exec(self):
+		""" run file_exec on every input file """
+		self.l , self.labs = [], [] 
+		self.v = {}
+		for i in self.valuenames:
+			self.v[i] = [] 
+		for i in self.valuelists:
+			self.v[i] = [] 
+		act_on_files(self.file_exec,self.sndlist,self.reslist, \
+			suffix='',filter=sndfile_filter)
+
+	def dir_eval(self):
+		pass
+
+	def file_gettruth(self,input):
+		""" get ground truth filenames """
+		from os.path import isfile
+		ftrulist = []
+		# search for match as filetask.input,".txt" 
+		ftru = '.'.join(input.split('.')[:-1])
+		ftru = '.'.join((ftru,'txt'))
+		if isfile(ftru):
+			ftrulist.append(ftru)
+		else:
+			# search for matches for filetask.input in the list of results
+			for i in range(len(self.reslist)):
+				check = '.'.join(self.reslist[i].split('.')[:-1])
+				check = '_'.join(check.split('_')[:-1])
+				if check == '.'.join(input.split('.')[:-1]):
+					ftrulist.append(self.reslist[i])
+		return ftrulist
+
+	def file_exec(self,input,output):
+		""" create filetask, extract data, evaluate """
+		filetask = self.task(input,params=self.params)
+		computed_data = filetask.compute_all()
+		ftrulist = self.file_gettruth(filetask.input)
+		for i in ftrulist:
+			filetask.eval(computed_data,i,mode='rocloc',vmode='')
+			""" append filetask.v to self.v """
+			for i in self.valuenames:
+				self.v[i].append(filetask.v[i])
+			for j in self.valuelists:
+				if filetask.v[j]:
+					for i in range(len(filetask.v[j])):
+						self.v[j].append(filetask.v[j][i])
+	
+	def file_eval(self):
+		pass
+	
+	def file_plot(self):
+		pass
+
+	def dir_plot(self):
+		pass
+	
+	def run_bench(self):
+		for mode in self.modes:
+			self.params.mode = mode
+			self.dir_exec()
+			self.dir_eval()
+			self.dir_plot()
+
+	def dir_eval_print(self):
+		self.dir_exec()
+		self.dir_eval()
+		self.pretty_print()
+
--- /dev/null
+++ b/python.old/aubio/bench/onset.py
@@ -1,0 +1,303 @@
+
+from aubio.bench.node import *
+from os.path import dirname,basename
+
+def mmean(l):
+	return sum(l)/max(float(len(l)),1)
+
+def stdev(l):
+	smean = 0
+	if not len(l): return smean
+	lmean = mmean(l)
+	for i in l:
+		smean += (i-lmean)**2
+	smean *= 1. / len(l)
+	return smean**.5
+
+class benchonset(bench):
+
+	""" list of values to store per file """
+	valuenames = ['orig','missed','Tm','expc','bad','Td']
+	""" list of lists to store per file """
+	valuelists = ['l','labs']
+	""" list of values to print per dir """
+	printnames = [ 'mode', 'thres', 'dist', 'prec', 'recl',
+		'GD', 'FP', 
+		'Torig', 'Ttrue', 'Tfp',  'Tfn',  'TTm',   'TTd',
+		'aTtrue', 'aTfp', 'aTfn', 'aTm',  'aTd',  
+		'mean', 'smean',  'amean', 'samean']
+
+	""" per dir """
+	formats = {'mode': "%12s" , 'thres': "%5.4s", 
+		'dist':  "%5.4s", 'prec': "%5.4s", 'recl':  "%5.4s",
+		'Torig': "%5.4s", 'Ttrue': "%5.4s", 'Tfp':   "%5.4s", 'Tfn':   "%5.4s", 
+		'TTm':    "%5.4s", 'TTd':    "%5.4s",
+		'aTtrue':"%5.4s", 'aTfp':  "%5.4s", 'aTfn':  "%5.4s", 
+		'aTm':   "%5.4s", 'aTd':   "%5.4s",
+		'mean':  "%5.6s", 'smean': "%5.6s", 
+		'amean':  "%5.6s", 'samean': "%5.6s", 
+		"GD":     "%5.4s", "FP":     "%5.4s",
+		"GDm":     "%5.4s", "FPd":     "%5.4s",
+		"bufsize": "%5.4s", "hopsize": "%5.4s",
+		"time":   "%5.4s"}
+
+	def dir_eval(self):
+		""" evaluate statistical data over the directory """
+		v = self.v
+
+		v['mode']      = self.params.onsetmode
+		v['thres']     = self.params.threshold 
+		v['bufsize']   = self.params.bufsize
+		v['hopsize']   = self.params.hopsize
+		v['silence']   = self.params.silence
+		v['mintol']   = self.params.mintol
+
+		v['Torig']     = sum(v['orig'])
+		v['TTm']       = sum(v['Tm'])
+		v['TTd']       = sum(v['Td'])
+		v['Texpc']     = sum(v['expc'])
+		v['Tbad']      = sum(v['bad'])
+		v['Tmissed']   = sum(v['missed'])
+		v['aTm']       = mmean(v['Tm'])
+		v['aTd']       = mmean(v['Td'])
+
+		v['mean']      = mmean(v['l'])
+		v['smean']     = stdev(v['l'])
+
+		v['amean']     = mmean(v['labs'])
+		v['samean']    = stdev(v['labs'])
+		
+		# old type calculations
+		# good detection rate 
+		v['GD']  = 100.*(v['Torig']-v['Tmissed']-v['TTm'])/v['Torig']
+		# false positive rate
+		v['FP']  = 100.*(v['Tbad']+v['TTd'])/v['Torig']
+		# good detection counting merged detections as good
+		v['GDm'] = 100.*(v['Torig']-v['Tmissed'])/v['Torig'] 
+		# false positives counting doubled as good
+		v['FPd'] = 100.*v['Tbad']/v['Torig']                
+		
+		# mirex type annotations
+		totaltrue = v['Texpc']-v['Tbad']-v['TTd']
+		totalfp = v['Tbad']+v['TTd']
+		totalfn = v['Tmissed']+v['TTm']
+		self.v['Ttrue']     = totaltrue
+		self.v['Tfp']       = totalfp
+		self.v['Tfn']       = totalfn
+		# average over the number of annotation files
+		N = float(len(self.reslist))
+		self.v['aTtrue']    = totaltrue/N
+		self.v['aTfp']      = totalfp/N
+		self.v['aTfn']      = totalfn/N
+
+		# F-measure
+		self.P = 100.*float(totaltrue)/max(totaltrue + totalfp,1)
+		self.R = 100.*float(totaltrue)/max(totaltrue + totalfn,1)
+		#if self.R < 0: self.R = 0
+		self.F = 2.* self.P*self.R / max(float(self.P+self.R),1)
+		self.v['dist']      = self.F
+		self.v['prec']      = self.P
+		self.v['recl']      = self.R
+
+
+	"""
+	Plot functions 
+	"""
+
+	def plotroc(self,d,plottitle=""):
+		import Gnuplot, Gnuplot.funcutils
+		gd = []
+		fp = []
+		for i in self.vlist:
+			gd.append(i['GD']) 
+			fp.append(i['FP']) 
+		d.append(Gnuplot.Data(fp, gd, with_='linespoints', 
+			title="%s %s" % (plottitle,i['mode']) ))
+
+	def plotplotroc(self,d,outplot=0,extension='ps'):
+		import Gnuplot, Gnuplot.funcutils
+		from sys import exit
+		g = Gnuplot.Gnuplot(debug=0, persist=1)
+		if outplot:
+			if   extension == 'ps':  ext, extension = '.ps' , 'postscript'
+			elif extension == 'png': ext, extension = '.png', 'png'
+			elif extension == 'svg': ext, extension = '.svg', 'svg'
+			else: exit("ERR: unknown plot extension")
+			g('set terminal %s' % extension)
+			g('set output \'roc-%s%s\'' % (outplot,ext))
+		xmax = 30 #max(fp)
+		ymin = 50 
+		g('set xrange [0:%f]' % xmax)
+		g('set yrange [%f:100]' % ymin)
+		# grid set
+		g('set grid')
+		g('set xtics 0,5,%f' % xmax)
+		g('set ytics %f,5,100' % ymin)
+		g('set key 27,65')
+		#g('set format \"%g\"')
+		g.title(basename(self.datadir))
+		g.xlabel('false positives (%)')
+		g.ylabel('correct detections (%)')
+		g.plot(*d)
+
+	def plotpr(self,d,plottitle=""):
+		import Gnuplot, Gnuplot.funcutils
+		x = []
+		y = []
+		for i in self.vlist:
+			x.append(i['prec']) 
+			y.append(i['recl']) 
+		d.append(Gnuplot.Data(x, y, with_='linespoints', 
+			title="%s %s" % (plottitle,i['mode']) ))
+
+	def plotplotpr(self,d,outplot=0,extension='ps'):
+		import Gnuplot, Gnuplot.funcutils
+		from sys import exit
+		g = Gnuplot.Gnuplot(debug=0, persist=1)
+		if outplot:
+			if   extension == 'ps':  ext, extension = '.ps' , 'postscript'
+			elif extension == 'png': ext, extension = '.png', 'png'
+			elif extension == 'svg': ext, extension = '.svg', 'svg'
+			else: exit("ERR: unknown plot extension")
+			g('set terminal %s' % extension)
+			g('set output \'pr-%s%s\'' % (outplot,ext))
+		g.title(basename(self.datadir))
+		g.xlabel('Recall (%)')
+		g.ylabel('Precision (%)')
+		g.plot(*d)
+
+	def plotfmeas(self,d,plottitle=""):
+		import Gnuplot, Gnuplot.funcutils
+		x,y = [],[]
+		for i in self.vlist:
+			x.append(i['thres']) 
+			y.append(i['dist']) 
+		d.append(Gnuplot.Data(x, y, with_='linespoints', 
+			title="%s %s" % (plottitle,i['mode']) ))
+
+	def plotplotfmeas(self,d,outplot="",extension='ps', title="F-measure"):
+		import Gnuplot, Gnuplot.funcutils
+		from sys import exit
+		g = Gnuplot.Gnuplot(debug=0, persist=1)
+		if outplot:
+			if   extension == 'ps':  terminal = 'postscript'
+			elif extension == 'png': terminal = 'png'
+			elif extension == 'svg': terminal = 'svg'
+			else: exit("ERR: unknown plot extension")
+			g('set terminal %s' % terminal)
+			g('set output \'fmeas-%s.%s\'' % (outplot,extension))
+		g.xlabel('threshold \\delta')
+		g.ylabel('F-measure (%)')
+		g('set xrange [0:1.2]')
+		g('set yrange [0:100]')
+		g.title(basename(self.datadir))
+		# grid set
+		#g('set grid')
+		#g('set xtics 0,5,%f' % xmax)
+		#g('set ytics %f,5,100' % ymin)
+		#g('set key 27,65')
+		#g('set format \"%g\"')
+		g.plot(*d)
+
+	def plotfmeasvar(self,d,var,plottitle=""):
+		import Gnuplot, Gnuplot.funcutils
+		x,y = [],[]
+		for i in self.vlist:
+			x.append(i[var]) 
+			y.append(i['dist']) 
+		d.append(Gnuplot.Data(x, y, with_='linespoints', 
+			title="%s %s" % (plottitle,i['mode']) ))
+	
+	def plotplotfmeasvar(self,d,var,outplot="",extension='ps', title="F-measure"):
+		import Gnuplot, Gnuplot.funcutils
+		from sys import exit
+		g = Gnuplot.Gnuplot(debug=0, persist=1)
+		if outplot:
+			if   extension == 'ps':  terminal = 'postscript'
+			elif extension == 'png': terminal = 'png'
+			elif extension == 'svg': terminal = 'svg'
+			else: exit("ERR: unknown plot extension")
+			g('set terminal %s' % terminal)
+			g('set output \'fmeas-%s.%s\'' % (outplot,extension))
+		g.xlabel(var)
+		g.ylabel('F-measure (%)')
+		#g('set xrange [0:1.2]')
+		g('set yrange [0:100]')
+		g.title(basename(self.datadir))
+		g.plot(*d)
+
+	def plotdiffs(self,d,plottitle=""):
+		import Gnuplot, Gnuplot.funcutils
+		v = self.v
+		l = v['l']
+		mean   = v['mean']
+		smean  = v['smean']
+		amean  = v['amean']
+		samean = v['samean']
+		val = []
+		per = [0] * 100
+		for i in range(0,100):
+			val.append(i*.001-.05)
+			for j in l: 
+				if abs(j-val[i]) <= 0.001:
+					per[i] += 1
+		total = v['Torig']
+		for i in range(len(per)): per[i] /= total/100.
+
+		d.append(Gnuplot.Data(val, per, with_='fsteps', 
+			title="%s %s" % (plottitle,v['mode']) ))
+		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (mean,smean))
+		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (amean,samean))
+
+
+	def plotplotdiffs(self,d,outplot=0,extension='ps'):
+		import Gnuplot, Gnuplot.funcutils
+		from sys import exit
+		g = Gnuplot.Gnuplot(debug=0, persist=1)
+		if outplot:
+			if   extension == 'ps':  ext, extension = '.ps' , 'postscript'
+			elif extension == 'png': ext, extension = '.png', 'png'
+			elif extension == 'svg': ext, extension = '.svg', 'svg'
+			else: exit("ERR: unknown plot extension")
+			g('set terminal %s' % extension)
+			g('set output \'diffhist-%s%s\'' % (outplot,ext))
+		g('eps(x) = 1./(sigma*(2.*3.14159)**.5) * exp ( - ( x - mean ) ** 2. / ( 2. * sigma ** 2. ))')
+		g.title(basename(self.datadir))
+		g.xlabel('delay to hand-labelled onset (s)')
+		g.ylabel('% number of correct detections / ms ')
+		g('set xrange [-0.05:0.05]')
+		g('set yrange [0:20]')
+		g.plot(*d)
+
+
+	def plothistcat(self,d,plottitle=""):
+		import Gnuplot, Gnuplot.funcutils
+		total = v['Torig']
+		for i in range(len(per)): per[i] /= total/100.
+
+		d.append(Gnuplot.Data(val, per, with_='fsteps', 
+			title="%s %s" % (plottitle,v['mode']) ))
+		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (mean,smean))
+		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (amean,samean))
+
+
+	def plotplothistcat(self,d,outplot=0,extension='ps'):
+		import Gnuplot, Gnuplot.funcutils
+		from sys import exit
+		g = Gnuplot.Gnuplot(debug=0, persist=1)
+		if outplot:
+			if   extension == 'ps':  ext, extension = '.ps' , 'postscript'
+			elif extension == 'png': ext, extension = '.png', 'png'
+			elif extension == 'svg': ext, extension = '.svg', 'svg'
+			else: exit("ERR: unknown plot extension")
+			g('set terminal %s' % extension)
+			g('set output \'diffhist-%s%s\'' % (outplot,ext))
+		g('eps(x) = 1./(sigma*(2.*3.14159)**.5) * exp ( - ( x - mean ) ** 2. / ( 2. * sigma ** 2. ))')
+		g.title(basename(self.datadir))
+		g.xlabel('delay to hand-labelled onset (s)')
+		g.ylabel('% number of correct detections / ms ')
+		g('set xrange [-0.05:0.05]')
+		g('set yrange [0:20]')
+		g.plot(*d)
+
+
--- /dev/null
+++ b/python.old/aubio/gnuplot.py
@@ -1,0 +1,222 @@
+"""Copyright (C) 2004 Paul Brossier <[email protected]>
+print aubio.__LICENSE__ for the terms of use
+"""
+
+__LICENSE__ = """\
+  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
+
+  This file is part of aubio.
+
+  aubio is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  aubio is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+
+def audio_to_array(filename):
+	import aubio.aubioclass
+	from numpy import arange
+	hopsize  = 2048
+	filei    = aubio.aubioclass.sndfile(filename)
+	framestep = 1/(filei.samplerate()+0.)
+	channels = filei.channels()
+	myvec    = aubio.aubioclass.fvec(hopsize,channels)
+	data = []
+	readsize = hopsize
+	while (readsize==hopsize):
+		readsize = filei.read(hopsize,myvec)
+		#for i in range(channels):
+		i = 0
+		curpos = 0
+		while (curpos < readsize):
+			data.append(myvec.get(curpos,i))
+			curpos+=1
+	time = arange(len(data))*framestep
+	return time,data
+
+def plot_audio(filenames, g, options):
+	todraw = len(filenames)
+	xorig = 0.
+	xratio = 1./todraw
+	g('set multiplot;')
+	while (len(filenames)):
+		time,data = audio_to_array(filenames.pop(0))
+		if todraw==1:
+			if max(time) < 1.:
+				time = [t*1000. for t in time]
+				g.xlabel('Time (ms)')
+			else:
+				g.xlabel('Time (s)')
+			g.ylabel('Amplitude')
+		curplot = make_audio_plot(time,data)
+		g('set size %f,%f;' % (options.xsize*xratio,options.ysize) )
+		g('set origin %f,0.;' % (xorig) )
+		g('set style data lines; \
+			set yrange [-1.:1.]; \
+			set xrange [0:%f]' % time[-1]) 
+		g.plot(curplot)
+		xorig += options.xsize*xratio 
+	g('unset multiplot;')
+
+def audio_to_spec(filename,minf = 0, maxf = 0, lowthres = -20., 
+		bufsize= 8192, hopsize = 1024):
+	from aubioclass import fvec,cvec,pvoc,sndfile
+	from math import log10
+	filei     = sndfile(filename)
+	srate     = float(filei.samplerate())
+	framestep = hopsize/srate
+	freqstep  = srate/bufsize
+	channels  = filei.channels()
+	myvec = fvec(hopsize,channels)
+	myfft = cvec(bufsize,channels)
+	pv    = pvoc(bufsize,hopsize,channels)
+	data,time,freq = [],[],[]
+
+	if maxf == 0.: maxf = bufsize/2
+	else: maxf = int(maxf/freqstep)
+	if minf: minf = int(minf/freqstep)
+	else: minf = 0 
+
+	for f in range(minf,maxf):
+		freq.append(f*freqstep)
+	readsize = hopsize
+	frameread = 0
+	while (readsize==hopsize):
+		readsize = filei.read(hopsize,myvec)
+		pv.do(myvec,myfft)
+		frame = []
+		i = 0 #for i in range(channels):
+		curpos = minf 
+		while (curpos < maxf):
+			frame.append(max(lowthres,20.*log10(myfft.get(curpos,i)**2+0.00001)))
+			curpos+=1
+		time.append(frameread*framestep)
+		data.append(frame)
+		frameread += 1
+	# crop data if unfinished frames
+	if len(data[-1]) != len(data[0]):
+		data = data[0:-2]
+		time = time[0:-2]
+	# verify size consistency
+	assert len(data) == len(time)
+	assert len(data[0]) == len(freq)
+	return data,time,freq
+
+def plot_spec(filename, g, options):
+	import Gnuplot
+	data,time,freq = audio_to_spec(filename,
+    minf=options.minf,maxf=options.maxf,
+    bufsize=options.bufsize,hopsize=options.hopsize)
+	xorig = 0.
+	if max(time) < 1.:
+		time = [t*1000. for t in time]
+		g.xlabel('Time (ms)')
+	else:
+		g.xlabel('Time (s)')
+	if options.xsize < 0.5 and not options.log and max(time) > 1.:
+		freq = [f/1000. for f in freq]
+		options.minf /= 1000.
+		options.maxf /= 1000.
+		g.ylabel('Frequency (kHz)')
+	else:
+		g.ylabel('Frequency (Hz)')
+	g('set pm3d map')
+	g('set palette rgbformulae -25,-24,-32')
+	g('set cbtics 20')
+	#g('set colorbox horizontal')
+	g('set xrange [0.:%f]' % time[-1]) 
+	if options.log:
+		g('set log y')
+		g('set yrange [%f:%f]' % (max(10,options.minf),options.maxf))
+	else:
+		g('set yrange [%f:%f]' % (options.minf,options.maxf))
+	g.splot(Gnuplot.GridData(data,time,freq, binary=1))
+	#xorig += 1./todraw
+
+def downsample_audio(time,data,maxpoints=10000):
+  """ resample audio data to last only maxpoints """
+  from numpy import array, resize
+  length = len(time)
+  downsample = length/maxpoints
+  if downsample == 0: downsample = 1
+  x = resize(array(time),length)[0:-1:downsample]
+  y = resize(array(data),length)[0:-1:downsample]
+  return x,y
+
+def make_audio_plot(time,data,maxpoints=10000):
+  """ create gnuplot plot from an audio file """
+  import Gnuplot, Gnuplot.funcutils
+  x,y = downsample_audio(time,data,maxpoints=maxpoints)
+  return Gnuplot.Data(x,y,with_='lines')
+
+def make_audio_envelope(time,data,maxpoints=10000):
+  """ create gnuplot plot from an audio file """
+  from numpy import array
+  import Gnuplot, Gnuplot.funcutils
+  bufsize = 500
+  x = [i.mean() for i in resize(array(time), (len(time)/bufsize,bufsize))] 
+  y = [i.mean() for i in resize(array(data), (len(time)/bufsize,bufsize))] 
+  x,y = downsample_audio(x,y,maxpoints=maxpoints)
+  return Gnuplot.Data(x,y,with_='lines')
+
+def gnuplot_addargs(parser):
+  """ add common gnuplot argument to OptParser object """
+  parser.add_option("-x","--xsize",
+          action="store", dest="xsize", default=1., 
+          type='float',help="define xsize for plot")
+  parser.add_option("-y","--ysize",
+          action="store", dest="ysize", default=1., 
+          type='float',help="define ysize for plot")
+  parser.add_option("--debug",
+          action="store_true", dest="debug", default=False, 
+          help="use gnuplot debug mode")
+  parser.add_option("--persist",
+          action="store_false", dest="persist", default=True, 
+          help="do not use gnuplot persistant mode")
+  parser.add_option("--lmargin",
+          action="store", dest="lmargin", default=None, 
+          type='int',help="define left margin for plot")
+  parser.add_option("--rmargin",
+          action="store", dest="rmargin", default=None, 
+          type='int',help="define right margin for plot")
+  parser.add_option("--bmargin",
+          action="store", dest="bmargin", default=None, 
+          type='int',help="define bottom margin for plot")
+  parser.add_option("--tmargin",
+          action="store", dest="tmargin", default=None, 
+          type='int',help="define top margin for plot")
+  parser.add_option("-O","--outplot",
+          action="store", dest="outplot", default=None, 
+          help="save plot to output.{ps,png}")
+
+def gnuplot_create(outplot='',extension='', options=None):
+  import Gnuplot
+  if options:
+    g = Gnuplot.Gnuplot(debug=options.debug, persist=options.persist)
+  else:
+    g = Gnuplot.Gnuplot(persist=1)
+  if not extension or not outplot: return g
+  if   extension == 'ps':  ext, extension = '.ps' , 'postscript'
+  elif extension == 'eps': ext, extension = '.eps' , 'postscript enhanced'
+  elif extension == 'epsc': ext, extension = '.eps' , 'postscript enhanced color'
+  elif extension == 'png': ext, extension = '.png', 'png'
+  elif extension == 'svg': ext, extension = '.svg', 'svg'
+  else: exit("ERR: unknown plot extension")
+  g('set terminal %s' % extension)
+  if options and options.lmargin: g('set lmargin %i' % options.lmargin)
+  if options and options.rmargin: g('set rmargin %i' % options.rmargin)
+  if options and options.bmargin: g('set bmargin %i' % options.bmargin)
+  if options and options.tmargin: g('set tmargin %i' % options.tmargin)
+  if outplot != "stdout":
+    g('set output \'%s%s\'' % (outplot,ext))
+  if options: g('set size %f,%f' % (options.xsize, options.ysize))
+  return g
--- /dev/null
+++ b/python.old/aubio/median.py
@@ -1,0 +1,69 @@
+"""Copyright (C) 2004 Paul Brossier <[email protected]>
+print aubio.__LICENSE__ for the terms of use
+"""
+
+__LICENSE__ = """\
+  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
+
+  This file is part of aubio.
+
+  aubio is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  aubio is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
+"""            
+
+""" 
+original author Tim Peters
+modified by Paul Brossier <[email protected]>
+inspired from http://www.ics.uci.edu/~eppstein/161/python/peters-selection.py
+"""
+
+def short_find(a, rank):
+    """ find the rank-th value in sorted a """
+    # copy to b before sorting
+    b = a[:]
+    b.sort()
+    return b[rank - 1]
+
+def percental(a, rank):
+    """ Find the rank'th-smallest value in a, in worst-case linear time. """
+    n = len(a)
+    assert 1 <= rank <= n
+    if n <= 7:
+        return short_find(a, rank)
+
+    ## Find median of median-of-7's.
+    ##medians = [short_find(a[i : i+7], 4) for i in xrange(0, n-6, 7)]
+    #median = find(medians, (len(medians) + 1) // 2)
+    
+    # modified to Find median
+    median = short_find([a[0], a[-1], a[n//2]], 2)
+
+    # Partition around the median.
+    # a[:i]   <= median
+    # a[j+1:] >= median
+    i, j = 0, n-1
+    while i <= j:
+        while a[i] < median:
+            i += 1
+        while a[j] > median:
+            j -= 1
+        if i <= j:
+            a[i], a[j] = a[j], a[i]
+            i += 1
+            j -= 1
+
+    if rank <= i:
+        return percental(a[:i], rank)
+    else:
+        return percental(a[i:], rank - i)
+
--- /dev/null
+++ b/python.old/aubio/onsetcompare.py
@@ -1,0 +1,143 @@
+"""Copyright (C) 2004 Paul Brossier <[email protected]>
+print aubio.__LICENSE__ for the terms of use
+"""
+
+__LICENSE__ = """\
+  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
+
+  This file is part of aubio.
+
+  aubio is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  aubio is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
+"""            
+
+""" this file contains routines to compare two lists of onsets or notes.
+it somewhat implements the Receiver Operating Statistic (ROC).
+see http://en.wikipedia.org/wiki/Receiver_operating_characteristic
+"""
+
+def onset_roc(ltru, lexp, eps):
+    """ compute differences between two lists 
+          orig = hits + missed + merged 
+          expc = hits + bad + doubled
+        returns orig, missed, merged, expc, bad, doubled 
+    """
+    orig, expc = len(ltru), len(lexp)
+    # if lexp is empty
+    if expc == 0 : return orig,orig,0,0,0,0
+    missed, bad, doubled, merged = 0, 0, 0, 0
+    # find missed and doubled ones first
+    for x in ltru:
+        correspond = 0
+        for y in lexp:
+            if abs(x-y) <= eps:    correspond += 1
+        if correspond == 0:        missed += 1
+        elif correspond > 1:       doubled += correspond - 1 
+    # then look for bad and merged ones
+    for y in lexp:
+        correspond = 0
+        for x in ltru:
+            if abs(x-y) <= eps:    correspond += 1
+        if correspond == 0:        bad += 1
+        elif correspond > 1:       merged += correspond - 1
+    # check consistancy of the results
+    assert ( orig - missed - merged == expc - bad - doubled)
+    return orig, missed, merged, expc, bad, doubled 
+
+def onset_diffs(ltru, lexp, eps):
+    """ compute differences between two lists 
+          orig = hits + missed + merged 
+          expc = hits + bad + doubled
+        returns orig, missed, merged, expc, bad, doubled 
+    """
+    orig, expc = len(ltru), len(lexp)
+    # if lexp is empty
+    l = []
+    if expc == 0 : return l 
+    # find missed and doubled ones first
+    for x in ltru:
+        correspond = 0
+        for y in lexp:
+            if abs(x-y) <= eps:    l.append(y-x) 
+    # return list of diffs
+    return l 
+
+def onset_rocloc(ltru, lexp, eps):
+    """ compute differences between two lists 
+          orig = hits + missed + merged 
+          expc = hits + bad + doubled
+        returns orig, missed, merged, expc, bad, doubled 
+    """
+    orig, expc = len(ltru), len(lexp)
+    l = []
+    labs = []
+    mean = 0
+    # if lexp is empty
+    if expc == 0 : return orig,orig,0,0,0,0,l,mean
+    missed, bad, doubled, merged = 0, 0, 0, 0
+    # find missed and doubled ones first
+    for x in ltru:
+        correspond = 0
+        for y in lexp:
+            if abs(x-y) <= eps:    correspond += 1
+        if correspond == 0:        missed += 1
+        elif correspond > 1:       doubled += correspond - 1 
+    # then look for bad and merged ones
+    for y in lexp:
+        correspond = 0
+        for x in ltru:
+            if abs(x-y) <= eps:    
+	    	correspond += 1
+            	l.append(y-x) 
+            	labs.append(abs(y-x))
+        if correspond == 0:        bad += 1
+        elif correspond > 1:       merged += correspond - 1
+    # check consistancy of the results
+    assert ( orig - missed - merged == expc - bad - doubled)
+    return orig, missed, merged, expc, bad, doubled, l, labs
+
+def notes_roc (la, lb, eps):
+    from numpy import transpose, add, resize 
+    """ creates a matrix of size len(la)*len(lb) then look for hit and miss
+    in it within eps tolerance windows """
+    gdn,fpw,fpg,fpa,fdo,fdp = 0,0,0,0,0,0
+    m = len(la)
+    n = len(lb)
+    x =           resize(la[:][0],(n,m))
+    y = transpose(resize(lb[:][0],(m,n)))
+    teps =  (abs(x-y) <= eps[0]) 
+    x =           resize(la[:][1],(n,m))
+    y = transpose(resize(lb[:][1],(m,n)))
+    tpitc = (abs(x-y) <= eps[1]) 
+    res = teps * tpitc
+    res = add.reduce(res,axis=0)
+    for i in range(len(res)) :
+        if res[i] > 1:
+            gdn+=1
+            fdo+=res[i]-1
+        elif res [i] == 1:
+            gdn+=1
+    fpa = n - gdn - fpa
+    return gdn,fpw,fpg,fpa,fdo,fdp
+
+def load_onsets(filename) :
+    """ load onsets targets / candidates files in arrays """
+    l = [];
+    
+    f = open(filename,'ro')
+    while 1:
+        line = f.readline().split()
+        if not line : break
+        l.append(float(line[0]))
+    
+    return l
--- /dev/null
+++ b/python.old/aubio/plot/keyboard.py
@@ -1,0 +1,46 @@
+
+def draw_keyboard(firstnote = 21, lastnote = 108, y0 = 0, y1 = 1):
+  import Gnuplot
+  octaves = 10
+
+  # build template of white notes
+  scalew  = 12/7.
+  xw_temp = [i*scalew for i in range(0,7)]
+  # build template of black notes
+  scaleb  = 6/7.
+  xb_temp = [i*scaleb for i in [1,3,7,9,11]]
+
+  xb,xw = [],[]
+  for octave in range(octaves-1): 
+    for i in xb_temp:
+      curnote = i+12*octave
+      if  curnote > firstnote-1 and curnote < lastnote+1:
+        xb = xb + [curnote] 
+  for octave in range(octaves-1): 
+    for i in xw_temp:
+      curnote = i+12*octave
+      if  curnote > firstnote-1 and curnote < lastnote+1:
+        xw = xw + [curnote]
+
+  xwdelta = [1/2. * scalew for i in range(len(xw))]
+  yw      = [y0+(y1-y0)*1/2. for i in range(len(xw))]
+  ywdelta = [(y1-y0)*1/2. for i in range(len(xw))]
+
+  xbdelta = [2/3. * scaleb for i in range(len(xb))]
+  yb      = [y0+(y1-y0)*2/3. for i in range(len(xb))]
+  ybdelta = [(y1-y0)*1/3. for i in range(len(xb))]
+
+  whites  = Gnuplot.Data(xw,yw,xwdelta,ywdelta,with_ = 'boxxyerrorbars')
+  blacks  = Gnuplot.Data(xb,yb,xbdelta,ybdelta,with_ = 'boxxyerrorbars fill solid')
+
+  return blacks,whites
+
+if __name__ == '__main__':
+  from aubio.gnuplot import gnuplot_create
+  blacks,whites = draw_keyboard(firstnote = 21, lastnote = 108)
+  g = gnuplot_create('','')
+  #g('set style fill solid .5')
+  #g('set xrange [60-.5:72+.5]')
+  #g('set yrange [-0.1:1.1]')
+
+  g.plot(whites,blacks)
--- /dev/null
+++ b/python.old/aubio/plot/notes.py
@@ -1,0 +1,90 @@
+__LICENSE__ = """\
+  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
+
+  This file is part of aubio.
+
+  aubio is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  aubio is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+def plotnote(la,title=None) :
+	if la[0,:].size() == 3:
+	        d = plotnote_withends(la, plot_title=title)
+	else: 
+	    # scale data if in freq (for REF.txt files)
+	    if max(la[:,1] > 128 ):
+	        print "scaling frequency data to midi range"
+	        la[:,1] /= 6.875
+	        la[:,1] = log(la[:,1])/0.6931
+	        la[:,1] *= 12
+	        la[:,1] -= 3
+	    d = plotnote_withoutends(la, plot_title=title)
+	return d
+
+def plotnote_multi(lalist,title=None,fileout=None) :
+	d=list()
+	for i in range(len(lalist)):
+	    d.append(plotnote(lalist[i], title=title))
+	return d
+       
+
+def plotnote_withends(la,plot_title=None) :
+	from numpy import array
+	import Gnuplot, Gnuplot.funcutils
+	d=[]
+	x_widths = array(la[:,1]-la[:,0])/2.
+	d.append(Gnuplot.Data(
+	        la[:,0]+x_widths,               # x centers
+	        la[:,2],                        # y centers
+	        x_widths,                       # x errors
+	        __notesheight*ones(len(la)),    # y errors
+	        title=plot_title,with_=('boxxyerrorbars fs 3')))
+	return d
+
+
+def plotnote_withoutends(la,plot_title=None) :
+        """ bug: fails drawing last note """
+	from numpy import array
+	import Gnuplot, Gnuplot.funcutils
+        d=[]
+        x_widths = array(la[1:,0]-la[:-1,0])/2;
+        d.append(Gnuplot.Data(
+                la[:-1,0]+x_widths,             # x centers
+                la[:-1,1],                      # y centers
+                x_widths,                       # x errors
+                __notesheight*ones(len(la)-1),  # y errors
+                title=plot_title,with_=('boxxyerrorbars fs 3')))
+        return d
+
+def plotnote_do(d,fileout=None):
+    import Gnuplot, Gnuplot.funcutils
+    g = Gnuplot.Gnuplot(debug=1, persist=1)
+    g.gnuplot('set style fill solid border 1; \
+    set size ratio 1/6; \
+    set boxwidth 0.9 relative; \
+    set mxtics 2.5; \
+    set mytics 2.5; \
+    set xtics 5; \
+    set ytics 1; \
+    set grid xtics ytics mxtics mytics')
+
+    g.xlabel('Time (s)')
+    g.ylabel('Midi pitch')
+    # do the plot
+    #g.gnuplot('set multiplot')
+    #for i in d:
+    g.plot(d[0])
+    #g.gnuplot('set nomultiplot') 
+    if fileout != None:
+        g.hardcopy(fileout, enhanced=1, color=0)
+
--- /dev/null
+++ b/python.old/aubio/task/__init__.py
@@ -1,0 +1,9 @@
+from aubio.aubioclass import *
+from aubio.task.task import task
+from aubio.task.params import taskparams
+from aubio.task.silence import tasksilence
+from aubio.task.onset import taskonset
+from aubio.task.beat import taskbeat
+from aubio.task.cut import taskcut
+from aubio.task.pitch import taskpitch
+from aubio.task.notes import tasknotes
--- /dev/null
+++ b/python.old/aubio/task/beat.py
@@ -1,0 +1,262 @@
+from aubio.aubioclass import *
+from onset import taskonset
+
+class taskbeat(taskonset):
+	def __init__(self,input,params=None,output=None):
+		""" open the input file and initialize arguments 
+		parameters should be set *before* calling this method.
+		"""
+		taskonset.__init__(self,input,output=None,params=params)
+		self.btwinlen  = 512**2/self.params.hopsize
+		self.btstep    = self.btwinlen/4
+		self.btoutput  = fvec(self.btstep,self.channels)
+		self.dfframe   = fvec(self.btwinlen,self.channels)
+		self.bt	       = beattracking(self.btwinlen,self.channels)
+		self.pos2      = 0
+		self.old       = -1000
+
+	def __call__(self):
+		taskonset.__call__(self)
+		#results = taskonset.__call__(self)
+		# write to current file
+		if self.pos2 == self.btstep - 1 : 
+			self.bt.do(self.dfframe,self.btoutput)
+			for i in range (self.btwinlen - self.btstep):
+				self.dfframe.set(self.dfframe.get(i+self.btstep,0),i,0) 
+			for i in range(self.btwinlen - self.btstep, self.btwinlen): 
+				self.dfframe.set(0,i,0)
+			self.pos2 = -1;
+		self.pos2 += 1
+		val = self.opick.pp.getval()
+		#if not results: val = 0
+		#else: val = results[1] 
+		self.dfframe.set(val,self.btwinlen - self.btstep + self.pos2,0)
+		i=0
+		for i in range(1,int( self.btoutput.get(0,0) ) ):
+			if self.pos2 == self.btoutput.get(i,0) and \
+				aubio_silence_detection(self.myvec(),
+					self.params.silence)!=1: 
+				now = self.frameread-0
+				period = (60 * self.params.samplerate) / ((now - self.old) * self.params.hopsize)
+				self.old = now
+				return now,period
+
+	def eval(self,results,tol=0.20,tolcontext=0.25):
+		obeats = self.gettruth()
+		etime = [result[0] for result in results]
+		otime = [obeat[0] for obeat in obeats]
+		CML_tot, CML_max, CML_start, CML_end = 0,0,0,0
+		AML_tot, AML_max, AML_start, AML_end = 0,0,0,0
+		AMLd_tot, AMLd_max, AMLd_start, AMLd_end = 0,0,0,0
+		AMLh_tot, AMLh_max, AMLh_start, AMLh_end = 0,0,0,0
+		AMLo_tot, AMLo_max, AMLo_start, AMLo_end = 0,0,0,0
+		# results iteration
+		j = 1
+		# for each annotation
+		for i in range(2,len(otime)-2):
+			if j+1 >= len(etime): break
+			count = 0
+			# look for next matching beat
+			while otime[i] > etime[j] - (otime[i] - otime[i+1])*tol:
+				if count > 0: 
+					#print "spurious etime"
+					if CML_end - CML_start > CML_max:
+						CML_max = CML_end - CML_start
+					CML_start, CML_end = j, j
+					if AMLh_end - AMLh_start > AMLh_max:
+						AMLh_max = AMLh_end - AMLh_start
+					AMLh_start, AMLh_end = j, j
+					if AMLd_end - AMLd_start > AMLd_max:
+						AMLd_max = AMLd_end - AMLd_start
+					AMLd_start, AMLd_end = j, j
+					if AMLo_end - AMLo_start > AMLo_max:
+						AMLo_max = AMLo_end - AMLo_start
+					AMLo_start, AMLo_end = j, j
+				j += 1
+				count += 1
+			if j+1 >= len(etime): break
+			#print otime[i-1],etime[j-1]," ",otime[i],etime[j]," ",otime[i+1],etime[j+1] 
+			prevtempo = (otime[i] - otime[i-1])
+			nexttempo = (otime[i+1] - otime[i])
+
+			current0  = (etime[j] > otime[i] - prevtempo*tol)
+			current1  = (etime[j] < otime[i] + prevtempo*tol)
+
+			# check correct tempo 
+			prev0 = (etime[j-1] > otime[i-1] - prevtempo*tolcontext)
+			prev1 = (etime[j-1] < otime[i-1] + prevtempo*tolcontext)
+			next0 = (etime[j+1] > otime[i+1] - nexttempo*tolcontext)
+			next1 = (etime[j+1] < otime[i+1] + nexttempo*tolcontext)
+
+			# check for off beat
+			prevoffb0 = (etime[j-1] > otime[i-1] - prevtempo/2 - prevtempo*tolcontext)
+			prevoffb1 = (etime[j-1] < otime[i-1] - prevtempo/2 + prevtempo*tolcontext)
+			nextoffb0 = (etime[j+1] > otime[i+1] - nexttempo/2 - nexttempo*tolcontext)
+			nextoffb1 = (etime[j+1] < otime[i+1] - nexttempo/2 + nexttempo*tolcontext)
+
+			# check half tempo 
+			prevhalf0 = (etime[j-1] > otime[i-1] + prevtempo - prevtempo/2*tolcontext)
+			prevhalf1 = (etime[j-1] < otime[i-1] + prevtempo + prevtempo/2*tolcontext)
+			nexthalf0 = (etime[j+1] > otime[i+1] - nexttempo - nexttempo/2*tolcontext)
+			nexthalf1 = (etime[j+1] < otime[i+1] - nexttempo + nexttempo/2*tolcontext)
+
+			# check double tempo
+			prevdoub0 = (etime[j-1] > otime[i-1] - prevtempo - prevtempo*2*tolcontext)
+			prevdoub1 = (etime[j-1] < otime[i-1] - prevtempo + prevtempo*2*tolcontext)
+			nextdoub0 = (etime[j+1] > otime[i+1] + nexttempo - nexttempo*2*tolcontext)
+			nextdoub1 = (etime[j+1] < otime[i+1] + nexttempo + nexttempo*2*tolcontext)
+
+			if current0 and current1 and prev0 and prev1 and next0 and next1: 
+				#print "YES!"
+				CML_end = j	
+				CML_tot += 1
+			else:
+				if CML_end - CML_start > CML_max:
+					CML_max = CML_end - CML_start
+				CML_start, CML_end = j, j
+			if current0 and current1 and prevhalf0 and prevhalf1 and nexthalf0 and nexthalf1: 
+				AMLh_end = j
+				AMLh_tot += 1
+			else:
+				if AMLh_end - AMLh_start > AMLh_max:
+					AMLh_max = AMLh_end - AMLh_start
+				AMLh_start, AMLh_end = j, j
+			if current0 and current1 and prevdoub0 and prevdoub1 and nextdoub0 and nextdoub1: 
+				AMLd_end = j
+				AMLd_tot += 1
+			else:
+				if AMLd_end - AMLd_start > AMLd_max:
+					AMLd_max = AMLd_end - AMLd_start
+				AMLd_start, AMLd_end = j, j
+			if current0 and current1 and prevoffb0 and prevoffb1 and nextoffb0 and nextoffb1: 
+				AMLo_end = j
+				AMLo_tot += 1
+			else:
+				if AMLo_end - AMLo_start > AMLo_max:
+					AMLo_max = AMLo_end - AMLo_start
+				AMLo_start, AMLo_end = j, j
+			# look for next matching beat
+			count = 0 
+			while otime[i] > etime[j] - (otime[i] - otime[i+1])*tolcontext:
+				j += 1
+				if count > 0: 
+					#print "spurious etime"
+					start = j
+				count += 1
+		total = float(len(otime))
+		CML_tot  /= total 
+		AMLh_tot /= total 
+		AMLd_tot /= total 
+		AMLo_tot /= total 
+		CML_cont  = CML_max/total
+		AMLh_cont = AMLh_max/total
+		AMLd_cont = AMLd_max/total
+		AMLo_cont = AMLo_max/total
+		return CML_cont, CML_tot, AMLh_cont, AMLh_tot, AMLd_cont, AMLd_tot, AMLo_cont, AMLo_tot
+
+#		for i in allfreq:
+#			freq.append(float(i) / 2. / N  * samplerate )
+#			while freq[i]>freqs[j]:
+#				j += 1
+#			a0 = weight[j-1]
+#			a1 = weight[j]
+#			f0 = freqs[j-1]
+#			f1 = freqs[j]
+#			if f0!=0:
+#				iweight.append((a1-a0)/(f1-f0)*freq[i] + (a0 - (a1 - a0)/(f1/f0 -1.)))
+#			else:
+#				iweight.append((a1-a0)/(f1-f0)*freq[i] + a0)
+#			while freq[i]>freqs[j]:
+#				j += 1
+			
+	def eval2(self,results,tol=0.2):
+		truth = self.gettruth()
+		obeats = [i[0] for i in truth] 
+		ebeats = [i[0]*self.params.step for i in results] 
+		NP = max(len(obeats), len(ebeats))
+		N  = int(round(max(max(obeats), max(ebeats))*100.)+100)
+		W  = int(round(tol*100.*60./median([i[1] for i in truth], len(truth)/2)))
+		ofunc = [0 for i in range(N+W)]
+		efunc = [0 for i in range(N+W)]
+		for i in obeats: ofunc[int(round(i*100.)+W)] = 1
+		for i in ebeats: efunc[int(round(i*100.)+W)] = 1
+		assert len(obeats) == sum(ofunc)
+		autocor = 0; m =0
+		for m in range (-W, W):
+			for i in range(W,N):
+				autocor += ofunc[i] * efunc[i-m] 
+		autocor /= float(NP)
+		return autocor
+	
+	def evaluation(self,results,tol=0.2,start=5.):
+
+		""" beat tracking evaluation function
+
+		computes P-score of experimental results (ebeats)
+		        against ground truth annotations (obeats) """
+
+		from aubio.median import short_find as median
+		truth = self.gettruth()
+		ebeats = [i[0]*self.params.step for i in results] 
+		obeats = [i[0] for i in truth] 
+
+		# trim anything found before start
+		while obeats[0] < start: obeats.pop(0)
+		while ebeats[0] < start: ebeats.pop(0)
+		# maximum number of beats found 
+		NP = max(len(obeats), len(ebeats))
+		# length of ofunc and efunc vector 
+		N  = int(round(max(max(obeats), max(ebeats))*100.)+100)
+		# compute W median of ground truth tempi 
+		tempi = []
+		for i in range(1,len(obeats)): tempi.append(obeats[i]-obeats[i-1])
+		W  = int(round(tol*100.*median(tempi,len(tempi)/2)))
+		# build ofunc and efunc functions, starting with W zeros  
+		ofunc = [0 for i in range(N+W)]
+		efunc = [0 for i in range(N+W)]
+		for i in obeats: ofunc[int(round(i*100.)+W)] = 1
+		for i in ebeats: efunc[int(round(i*100.)+W)] = 1
+		# optional: make sure we didn't miss any beats  
+		assert len(obeats) == sum(ofunc)
+		assert len(ebeats) == sum(efunc)
+		# compute auto correlation 
+		autocor = 0; m =0
+		for m in range (-W, W):
+		  for i in range(W,N):
+		    autocor += ofunc[i] * efunc[i-m] 
+		autocor /= float(NP)
+		return autocor
+
+	def gettruth(self):
+		import os.path
+		from aubio.txtfile import read_datafile
+		datafile = self.input.replace('.wav','.txt')
+		if not os.path.isfile(datafile):
+			print "no ground truth "
+			return False,False
+		else:
+			values = read_datafile(datafile,depth=0)
+			old = -1000
+			for i in range(len(values)):
+				now = values[i]
+				period = 60 / (now - old)
+				old = now
+				values[i] = [now,period]
+		return values
+	
+
+	def plot(self,oplots,results):
+		import Gnuplot
+		oplots.append(Gnuplot.Data(results,with_='linespoints',title="auto"))
+
+	def plotplot(self,wplot,oplots,outplot=None,extension=None,xsize=1.,ysize=1.,spectro=False):
+		import Gnuplot
+		from aubio.gnuplot import gnuplot_create, audio_to_array, make_audio_plot
+		import re
+		# audio data
+		#time,data = audio_to_array(self.input)
+		#f = make_audio_plot(time,data)
+
+		g = gnuplot_create(outplot=outplot, extension=extension)
+		oplots = [Gnuplot.Data(self.gettruth(),with_='linespoints',title="orig")] + oplots
+		g.plot(*oplots)
--- /dev/null
+++ b/python.old/aubio/task/cut.py
@@ -1,0 +1,42 @@
+from task import task
+from aubio.aubioclass import *
+
+class taskcut(task):
+	def __init__(self,input,slicetimes,params=None,output=None):
+		""" open the input file and initialize arguments 
+		parameters should be set *before* calling this method.
+		"""
+		from os.path import basename,splitext
+		task.__init__(self,input,output=None,params=params)
+		self.soundoutbase, self.soundoutext = splitext(basename(self.input))
+		self.newname   = "%s%s%09.5f%s%s" % (self.soundoutbase,".",
+					self.frameread*self.params.step,".",self.soundoutext)
+		self.fileo	= sndfile(self.newname,model=self.filei)
+		self.myvec	= fvec(self.params.hopsize,self.channels)
+		self.mycopy	= fvec(self.params.hopsize,self.channels)
+		self.slicetimes = slicetimes 
+
+	def __call__(self):
+		task.__call__(self)
+		# write to current file
+		if len(self.slicetimes) and self.frameread >= self.slicetimes[0][0]:
+			self.slicetimes.pop(0)
+			# write up to 1st zero crossing
+			zerocross = 0
+			while ( abs( self.myvec.get(zerocross,0) ) > self.params.zerothres ):
+				zerocross += 1
+			writesize = self.fileo.write(zerocross,self.myvec)
+			fromcross = 0
+			while (zerocross < self.readsize):
+				for i in range(self.channels):
+					self.mycopy.set(self.myvec.get(zerocross,i),fromcross,i)
+					fromcross += 1
+					zerocross += 1
+			del self.fileo
+			self.fileo = sndfile("%s%s%09.5f%s%s" % (self.soundoutbase,".",
+				self.frameread*self.params.step,".",self.soundoutext),model=self.filei)
+			writesize = self.fileo.write(fromcross,self.mycopy)
+		else:
+			writesize = self.fileo.write(self.readsize,self.myvec)
+
+
--- /dev/null
+++ b/python.old/aubio/task/notes.py
@@ -1,0 +1,159 @@
+
+from aubio.task import task
+from aubio.aubioclass import *
+
+class tasknotes(task):
+	def __init__(self,input,output=None,params=None):
+		task.__init__(self,input,params=params)
+		self.opick = onsetpick(self.params.bufsize,
+			self.params.hopsize,
+			self.channels,
+			self.myvec,
+			self.params.threshold,
+			mode=self.params.onsetmode,
+			dcthreshold=self.params.dcthreshold,
+			derivate=self.params.derivate)
+		self.pitchdet  = pitch(mode=self.params.pitchmode,
+			bufsize=self.params.pbufsize,
+			hopsize=self.params.phopsize,
+			channels=self.channels,
+			samplerate=self.srate,
+			omode=self.params.omode)
+		self.olist = [] 
+		self.ofunc = []
+		self.maxofunc = 0
+		self.last = -1000
+		self.oldifreq = 0
+		if self.params.localmin:
+			self.ovalist   = [0., 0., 0., 0., 0.]
+
+	def __call__(self):
+		from aubio.median import short_find
+		task.__call__(self)
+		isonset,val = self.opick.do(self.myvec)
+		if (aubio_silence_detection(self.myvec(),self.params.silence)):
+			isonset=0
+			freq = -1.
+		else:
+			freq = self.pitchdet(self.myvec)
+		minpitch = self.params.pitchmin
+		maxpitch = self.params.pitchmax
+		if maxpitch and freq > maxpitch : 
+			freq = -1.
+		elif minpitch and freq < minpitch :
+			freq = -1.
+		freq = aubio_freqtomidi(freq)
+		if self.params.pitchsmooth:
+			self.shortlist.append(freq)
+			self.shortlist.pop(0)
+			smoothfreq = short_find(self.shortlist,
+				len(self.shortlist)/2)
+			freq = smoothfreq
+		now = self.frameread
+		ifreq = int(round(freq))
+		if self.oldifreq == ifreq:
+			self.oldifreq = ifreq
+		else:
+			self.oldifreq = ifreq
+			ifreq = 0 
+		# take back delay
+		if self.params.delay != 0.: now -= self.params.delay
+		if now < 0 :
+			now = 0
+		if (isonset == 1):
+			if self.params.mintol:
+				# prune doubled 
+				if (now - self.last) > self.params.mintol:
+					self.last = now
+					return now, 1, freq, ifreq
+				else:
+					return now, 0, freq, ifreq
+			else:
+				return now, 1, freq, ifreq 
+		else:
+			return now, 0, freq, ifreq
+
+
+	def fprint(self,foo):
+		print self.params.step*foo[0], foo[1], foo[2], foo[3]
+
+	def compute_all(self):
+		""" Compute data """
+    		now, onset, freq, ifreq = [], [], [], []
+		while(self.readsize==self.params.hopsize):
+			n, o, f, i = self()
+			now.append(n*self.params.step)
+			onset.append(o)
+			freq.append(f)
+			ifreq.append(i)
+			if self.params.verbose:
+				self.fprint((n,o,f,i))
+    		return now, onset, freq, ifreq 
+
+	def plot(self,now,onset,freq,ifreq,oplots):
+		import Gnuplot
+
+		oplots.append(Gnuplot.Data(now,freq,with_='lines',
+			title=self.params.pitchmode))
+		oplots.append(Gnuplot.Data(now,ifreq,with_='lines',
+			title=self.params.pitchmode))
+
+		temponsets = []
+		for i in onset:
+			temponsets.append(i*1000)
+		oplots.append(Gnuplot.Data(now,temponsets,with_='impulses',
+			title=self.params.pitchmode))
+
+	def plotplot(self,wplot,oplots,outplot=None,multiplot = 0):
+		from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot
+		import re
+		import Gnuplot
+		# audio data
+		time,data = audio_to_array(self.input)
+		f = make_audio_plot(time,data)
+
+		# check if ground truth exists
+		#timet,pitcht = self.gettruth()
+		#if timet and pitcht:
+		#	oplots = [Gnuplot.Data(timet,pitcht,with_='lines',
+		#		title='ground truth')] + oplots
+
+		t = Gnuplot.Data(0,0,with_='impulses') 
+
+		g = gnuplot_init(outplot)
+		g('set title \'%s\'' % (re.sub('.*/','',self.input)))
+		g('set multiplot')
+		# hack to align left axis
+		g('set lmargin 15')
+		# plot waveform and onsets
+		g('set size 1,0.3')
+		g('set origin 0,0.7')
+		g('set xrange [0:%f]' % max(time)) 
+		g('set yrange [-1:1]') 
+		g.ylabel('amplitude')
+		g.plot(f)
+		g('unset title')
+		# plot onset detection function
+
+
+		g('set size 1,0.7')
+		g('set origin 0,0')
+		g('set xrange [0:%f]' % max(time))
+		g('set yrange [20:100]')
+		g('set key right top')
+		g('set noclip one') 
+		#g('set format x ""')
+		#g('set log y')
+		#g.xlabel('time (s)')
+		g.ylabel('f0 (Hz)')
+		if multiplot:
+			for i in range(len(oplots)):
+				# plot onset detection functions
+				g('set size 1,%f' % (0.7/(len(oplots))))
+				g('set origin 0,%f' % (float(i)*0.7/(len(oplots))))
+				g('set xrange [0:%f]' % max(time))
+				g.plot(oplots[i])
+		else:
+			g.plot(*oplots)
+		#g('unset multiplot')
+
--- /dev/null
+++ b/python.old/aubio/task/onset.py
@@ -1,0 +1,220 @@
+from aubio.task.task import task
+from aubio.aubioclass import *
+
+class taskonset(task):
+	def __init__(self,input,output=None,params=None):
+		""" open the input file and initialize arguments 
+		parameters should be set *before* calling this method.
+		"""
+		task.__init__(self,input,params=params)
+		self.opick = onsetpick(self.params.bufsize,
+			self.params.hopsize,
+			self.myvec,
+			self.params.threshold,
+			mode=self.params.onsetmode,
+			dcthreshold=self.params.dcthreshold,
+			derivate=self.params.derivate)
+		self.olist = [] 
+		self.ofunc = []
+		self.maxofunc = 0
+		self.last = 0
+		if self.params.localmin:
+			self.ovalist   = [0., 0., 0., 0., 0.]
+
+	def __call__(self):
+		task.__call__(self)
+		isonset,val = self.opick.do(self.myvec)
+		if (aubio_silence_detection(self.myvec(),self.params.silence)):
+			isonset=0
+		if self.params.storefunc:
+			self.ofunc.append(val)
+		if self.params.localmin:
+			if val > 0: self.ovalist.append(val)
+			else: self.ovalist.append(0)
+			self.ovalist.pop(0)
+		if (isonset > 0.):
+			if self.params.localmin:
+				# find local minima before peak 
+				i=len(self.ovalist)-1
+				while self.ovalist[i-1] < self.ovalist[i] and i > 0:
+					i -= 1
+				now = (self.frameread+1-i)
+			else:
+				now = self.frameread
+			# take back delay
+			if self.params.delay != 0.: now -= self.params.delay
+			if now < 0 :
+				now = 0
+			if self.params.mintol:
+				# prune doubled 
+				if (now - self.last) > self.params.mintol:
+					self.last = now
+					return now, val
+			else:
+				return now, val 
+
+
+	def fprint(self,foo):
+		print self.params.step*foo[0]
+
+	def eval(self,inputdata,ftru,mode='roc',vmode=''):
+		from aubio.txtfile import read_datafile 
+		from aubio.onsetcompare import onset_roc, onset_diffs, onset_rocloc
+		ltru = read_datafile(ftru,depth=0)
+		lres = []
+		for i in range(len(inputdata)): lres.append(inputdata[i][0]*self.params.step)
+		if vmode=='verbose':
+			print "Running with mode %s" % self.params.onsetmode, 
+			print " and threshold %f" % self.params.threshold, 
+			print " on file", self.input
+		#print ltru; print lres
+		if mode == 'local':
+			l = onset_diffs(ltru,lres,self.params.tol)
+			mean = 0
+			for i in l: mean += i
+			if len(l): mean = "%.3f" % (mean/len(l))
+			else: mean = "?0"
+			return l, mean
+		elif mode == 'roc':
+			self.orig, self.missed, self.merged, \
+				self.expc, self.bad, self.doubled = \
+				onset_roc(ltru,lres,self.params.tol)
+		elif mode == 'rocloc':
+			self.v = {}
+			self.v['orig'], self.v['missed'], self.v['Tm'], \
+				self.v['expc'], self.v['bad'], self.v['Td'], \
+				self.v['l'], self.v['labs'] = \
+				onset_rocloc(ltru,lres,self.params.tol)
+
+	def plot(self,onsets,ofunc,wplot,oplots,nplot=False):
+		import Gnuplot, Gnuplot.funcutils
+		import aubio.txtfile
+		import os.path
+		from numpy import arange, array, ones
+		from aubio.onsetcompare import onset_roc
+
+		x1,y1,y1p = [],[],[]
+		oplot = []
+		if self.params.onsetmode in ('mkl','kl'): ofunc[0:10] = [0] * 10
+
+		self.lenofunc = len(ofunc) 
+		self.maxofunc = max(ofunc)
+		# onset detection function 
+		downtime = arange(len(ofunc))*self.params.step
+		oplot.append(Gnuplot.Data(downtime,ofunc,with_='lines',title=self.params.onsetmode))
+
+		# detected onsets
+		if not nplot:
+			for i in onsets:
+				x1.append(i[0]*self.params.step)
+				y1.append(self.maxofunc)
+				y1p.append(-self.maxofunc)
+			#x1 = array(onsets)*self.params.step
+			#y1 = self.maxofunc*ones(len(onsets))
+			if x1:
+				oplot.append(Gnuplot.Data(x1,y1,with_='impulses'))
+				wplot.append(Gnuplot.Data(x1,y1p,with_='impulses'))
+
+		oplots.append((oplot,self.params.onsetmode,self.maxofunc))
+
+		# check if ground truth datafile exists
+		datafile = self.input.replace('.wav','.txt')
+		if datafile == self.input: datafile = ""
+		if not os.path.isfile(datafile):
+			self.title = "" #"(no ground truth)"
+		else:
+			t_onsets = aubio.txtfile.read_datafile(datafile)
+			x2 = array(t_onsets).resize(len(t_onsets))
+			y2 = self.maxofunc*ones(len(t_onsets))
+			wplot.append(Gnuplot.Data(x2,y2,with_='impulses'))
+			
+			tol = 0.050 
+
+			orig, missed, merged, expc, bad, doubled = \
+				onset_roc(x2,x1,tol)
+			self.title = "GD %2.3f%% FP %2.3f%%" % \
+				((100*float(orig-missed-merged)/(orig)),
+				 (100*float(bad+doubled)/(orig)))
+
+
+	def plotplot(self,wplot,oplots,outplot=None,extension=None,xsize=1.,ysize=1.,spectro=False):
+		from aubio.gnuplot import gnuplot_create, audio_to_array, make_audio_plot, audio_to_spec
+		import re
+		# prepare the plot
+		g = gnuplot_create(outplot=outplot, extension=extension)
+		g('set title \'%s\'' % (re.sub('.*/','',self.input)))
+		if spectro:
+			g('set size %f,%f' % (xsize,1.3*ysize) )
+		else:
+			g('set size %f,%f' % (xsize,ysize) )
+		g('set multiplot')
+
+		# hack to align left axis
+		g('set lmargin 3')
+		g('set rmargin 6')
+
+		if spectro:
+			import Gnuplot
+			minf = 50
+			maxf = 500 
+			data,time,freq = audio_to_spec(self.input,minf=minf,maxf=maxf)
+			g('set size %f,%f' % (1.24*xsize , 0.34*ysize) )
+			g('set origin %f,%f' % (-0.12,0.65*ysize))
+			g('set xrange [0.:%f]' % time[-1]) 
+			g('set yrange [%f:%f]' % (minf,maxf))
+			g('set pm3d map')
+			g('unset colorbox')
+			g('set lmargin 0')
+			g('set rmargin 0')
+			g('set tmargin 0')
+			g('set palette rgbformulae -25,-24,-32')
+			g.xlabel('time (s)',offset=(0,1.))
+			g.ylabel('freq (Hz)')
+			g('set origin 0,%f' % (1.0*ysize) ) 
+			g('set format x "%1.1f"')
+			#if log:
+			#	g('set yrange [%f:%f]' % (max(10,minf),maxf))
+			#	g('set log y')
+			g.splot(Gnuplot.GridData(data,time,freq, binary=1, title=''))
+		else:
+			# plot waveform and onsets
+			time,data = audio_to_array(self.input)
+			wplot = [make_audio_plot(time,data)] + wplot
+			g('set origin 0,%f' % (0.7*ysize) )
+			g('set size %f,%f' % (xsize,0.3*ysize))
+			g('set format y "%1f"')
+			g('set xrange [0:%f]' % max(time)) 
+			g('set yrange [-1:1]') 
+			g('set noytics')
+			g('set y2tics -1,1')
+			g.xlabel('time (s)',offset=(0,0.7))
+			g.ylabel('amplitude')
+			g.plot(*wplot)
+
+		# default settings for next plots
+		g('unset title')
+		g('set format x ""')
+		g('set format y "%3e"')
+		g('set tmargin 0')
+		g.xlabel('')
+
+		N = len(oplots)
+		y = 0.7*ysize # the vertical proportion of the plot taken by onset functions
+		delta = 0.035 # the constant part of y taken by last plot label and data
+		for i in range(N):
+			# plot onset detection functions
+			g('set size %f,%f' % ( xsize, (y-delta)/N))
+			g('set origin 0,%f' % ((N-i-1)*(y-delta)/N + delta ))
+			g('set nokey')
+			g('set xrange [0:%f]' % (self.lenofunc*self.params.step))
+			g('set yrange [0:%f]' % (1.1*oplots[i][2]))
+			g('set y2tics ("0" 0, "%d" %d)' % (round(oplots[i][2]),round(oplots[i][2])))
+			g.ylabel(oplots[i][1])
+			if i == N-1:
+				g('set size %f,%f' % ( xsize, (y-delta)/N + delta ) )
+				g('set origin 0,0')
+				g.xlabel('time (s)', offset=(0,0.7))
+				g('set format x')
+			g.plot(*oplots[i][0])
+
+		g('unset multiplot')
--- /dev/null
+++ b/python.old/aubio/task/params.py
@@ -1,0 +1,33 @@
+
+class taskparams(object):
+	""" default parameters for task classes """
+	def __init__(self,input=None,output=None):
+		self.silence = -90
+		self.derivate = False
+		self.localmin = False
+		self.delay = 4.
+		self.storefunc = False
+		self.bufsize = 512
+		self.hopsize = 256
+		self.pbufsize = 2048
+		self.phopsize =  512
+		self.samplerate = 44100
+		self.tol = 0.05
+		self.mintol = 0.0
+		self.step = float(self.hopsize)/float(self.samplerate)
+		self.threshold = 0.1
+		self.onsetmode = 'dual'
+		self.pitchmode = 'yin'
+		# best threshold for yin monophonic Mirex04 (depth of f0) 
+		self.yinthresh = 0.15 
+		# best thresh for yinfft monophonic Mirex04 (tradeoff sil/gd)
+		# also best param for yinfft polyphonic Mirex04
+		self.yinfftthresh = 0.85 
+		self.pitchsmooth = 0
+		self.pitchmin=20.
+		self.pitchmax=20000.
+		self.pitchdelay = -0.5
+		self.dcthreshold = -1.
+		self.omode = "freq"
+		self.verbose   = False
+
--- /dev/null
+++ b/python.old/aubio/task/pitch.py
@@ -1,0 +1,234 @@
+from aubio.task.task import task
+from aubio.task.silence import tasksilence
+from aubio.aubioclass import *
+
+class taskpitch(task):
+	def __init__(self,input,params=None):
+		task.__init__(self,input,params=params)
+		self.shortlist = [0. for i in range(self.params.pitchsmooth)]
+		if self.params.pitchmode == 'yin':
+			tolerance = self.params.yinthresh
+		elif self.params.pitchmode == 'yinfft':
+			tolerance = self.params.yinfftthresh
+		else:
+			tolerance = 0.
+		self.pitchdet	= pitch(mode=self.params.pitchmode,
+			bufsize=self.params.bufsize,
+			hopsize=self.params.hopsize,
+			samplerate=self.srate,
+			omode=self.params.omode,
+			tolerance = tolerance)
+
+	def __call__(self):
+		from aubio.median import short_find
+		task.__call__(self)
+		if (aubio_silence_detection(self.myvec(),self.params.silence)==1):
+			freq = -1.
+		else:
+			freq = self.pitchdet(self.myvec)
+		minpitch = self.params.pitchmin
+		maxpitch = self.params.pitchmax
+		if maxpitch and freq > maxpitch : 
+			freq = -1.
+		elif minpitch and freq < minpitch :
+			freq = -1.
+		if self.params.pitchsmooth:
+			self.shortlist.append(freq)
+			self.shortlist.pop(0)
+			smoothfreq = short_find(self.shortlist,
+				len(self.shortlist)/2)
+			return smoothfreq
+		else:
+			return freq
+
+	def compute_all(self):
+		""" Compute data """
+    		mylist    = []
+		while(self.readsize==self.params.hopsize):
+			freq = self()
+			mylist.append(freq)
+			if self.params.verbose:
+				self.fprint("%s\t%s" % (self.frameread*self.params.step,freq))
+    		return mylist
+
+	def gettruth(self):
+		""" extract ground truth array in frequency """
+		import os.path
+		""" from wavfile.txt """
+		datafile = self.input.replace('.wav','.txt')
+		if datafile == self.input: datafile = ""
+		""" from file.<midinote>.wav """
+		# FIXME very weak check
+		floatpit = self.input.split('.')[-2]
+		if not os.path.isfile(datafile) and len(self.input.split('.')) < 3:
+			print "no ground truth "
+			return False,False
+		elif floatpit:
+			try:
+				self.truth = float(floatpit)
+				#print "ground truth found in filename:", self.truth
+				tasksil = tasksilence(self.input,params=self.params)
+				time,pitch =[],[]
+				while(tasksil.readsize==tasksil.params.hopsize):
+					tasksil()
+					time.append(tasksil.params.step*(tasksil.frameread))
+					if not tasksil.issilence:
+						pitch.append(self.truth)
+					else:
+						pitch.append(-1.)
+				return time,pitch
+			except ValueError:
+				# FIXME very weak check
+				if not os.path.isfile(datafile):
+					print "no ground truth found"
+					return 0,0
+				else:
+					from aubio.txtfile import read_datafile
+					values = read_datafile(datafile)
+					time, pitch = [], []
+					for i in range(len(values)):
+						time.append(values[i][0])
+						if values[i][1] == 0.0:
+							pitch.append(-1.)
+						else:
+							pitch.append(aubio_freqtomidi(values[i][1]))
+					return time,pitch
+
+	def oldeval(self,results):
+		def mmean(l):
+			return sum(l)/max(float(len(l)),1)
+
+		from aubio.median import percental 
+		timet,pitcht = self.gettruth()
+		res = []
+		for i in results:
+			#print i,self.truth
+			if i <= 0: pass
+			else: res.append(self.truth-i)
+		if not res or len(res) < 3: 
+			avg = self.truth; med = self.truth 
+		else:
+			avg = mmean(res) 
+			med = percental(res,len(res)/2) 
+		return self.truth, self.truth-med, self.truth-avg
+
+	def eval(self,pitch,tol=0.5):
+		timet,pitcht = self.gettruth()
+		pitch = [aubio_freqtomidi(i) for i in pitch]
+		for i in range(len(pitch)):
+			if pitch[i] == "nan" or pitch[i] == -1:
+				pitch[i] = -1
+		time = [ (i+self.params.pitchdelay)*self.params.step for i in range(len(pitch)) ]
+		#print len(timet),len(pitcht)
+		#print len(time),len(pitch)
+		if len(timet) != len(time):
+			time = time[1:len(timet)+1]
+			pitch = pitch[1:len(pitcht)+1]
+			#pitcht = [aubio_freqtomidi(i) for i in pitcht]
+			for i in range(len(pitcht)):
+				if pitcht[i] == "nan" or pitcht[i] == "-inf" or pitcht[i] == -1:
+					pitcht[i] = -1
+		assert len(timet) == len(time)
+		assert len(pitcht) == len(pitch)
+		osil, esil, opit, epit, echr = 0, 0, 0, 0, 0
+		for i in range(len(pitcht)):
+			if pitcht[i] == -1: # currently silent
+				osil += 1 # count a silence
+				if pitch[i] <= 0. or pitch[i] == "nan": 
+					esil += 1 # found a silence
+			else:
+				opit +=1
+				if abs(pitcht[i] - pitch[i]) < tol:
+					epit += 1
+					echr += 1
+				elif abs(pitcht[i] - pitch[i]) % 12. < tol:
+					echr += 1
+				#else:
+				#	print timet[i], pitcht[i], time[i], pitch[i]
+		#print "origsilence", "foundsilence", "origpitch", "foundpitch", "orig pitchroma", "found pitchchroma"
+		#print 100.*esil/float(osil), 100.*epit/float(opit), 100.*echr/float(opit)
+		return osil, esil, opit, epit, echr
+
+	def plot(self,pitch,wplot,oplots,titles,outplot=None):
+		import Gnuplot
+
+		time = [ (i+self.params.pitchdelay)*self.params.step for i in range(len(pitch)) ]
+		pitch = [aubio_freqtomidi(i) for i in pitch]
+		oplots.append(Gnuplot.Data(time,pitch,with_='lines',
+			title=self.params.pitchmode))
+		titles.append(self.params.pitchmode)
+
+			
+	def plotplot(self,wplot,oplots,titles,outplot=None,extension=None,xsize=1.,ysize=1.,multiplot = 1, midi = 1, truth = 1):
+		from aubio.gnuplot import gnuplot_create , audio_to_array, make_audio_plot
+		import re
+		import Gnuplot
+
+		# check if ground truth exists
+		if truth:
+			timet,pitcht = self.gettruth()
+			if timet and pitcht:
+				oplots = [Gnuplot.Data(timet,pitcht,with_='lines',
+					title='ground truth')] + oplots
+
+		g = gnuplot_create(outplot=outplot, extension=extension)
+		g('set title \'%s\'' % (re.sub('.*/','',self.input)))
+		g('set size %f,%f' % (xsize,ysize) )
+		g('set multiplot')
+		# hack to align left axis
+		g('set lmargin 4')
+		g('set rmargin 4')
+    # plot waveform
+		time,data = audio_to_array(self.input)
+		wplot = [make_audio_plot(time,data)]
+		g('set origin 0,%f' % (0.7*ysize) )
+		g('set size %f,%f' % (xsize,0.3*ysize))
+		#g('set format y "%1f"')
+		g('set xrange [0:%f]' % max(time)) 
+		g('set yrange [-1:1]') 
+		g('set noytics')
+		g('set y2tics -1,1')
+		g.xlabel('time (s)',offset=(0,0.7))
+		g.ylabel('amplitude')
+		g.plot(*wplot)
+
+		# default settings for next plots
+		g('unset title')
+		g('set format x ""')
+		g('set format y "%3e"')
+		g('set tmargin 0')
+		g.xlabel('')
+		g('set noclip one') 
+
+		if not midi:
+			g('set log y')
+			#g.xlabel('time (s)')
+			g.ylabel('f0 (Hz)')
+			g('set yrange [100:%f]' % self.params.pitchmax) 
+		else: 
+			g.ylabel('midi')
+			g('set yrange [%f:%f]' % (aubio_freqtomidi(self.params.pitchmin), aubio_freqtomidi(self.params.pitchmax)))
+			g('set y2tics %f,%f' % (round(aubio_freqtomidi(self.params.pitchmin)+.5),12))
+		
+		if multiplot:
+			N = len(oplots)
+			y = 0.7*ysize # the vertical proportion of the plot taken by onset functions
+			delta = 0.035 # the constant part of y taken by last plot label and data
+			for i in range(N):
+				# plot pitch detection functions
+				g('set size %f,%f' % ( xsize, (y-delta)/N))
+				g('set origin 0,%f' % ((N-i-1)*(y-delta)/N + delta ))
+				g('set nokey')
+				g('set xrange [0:%f]' % max(time))
+				g.ylabel(titles[i])
+				if i == N-1:
+					g('set size %f,%f' % (xsize, (y-delta)/N + delta ) )
+					g('set origin 0,0')
+					g.xlabel('time (s)', offset=(0,0.7))
+					g('set format x')
+				g.plot(oplots[i])
+		else:
+			g('set key right top')
+			g.plot(*oplots)
+		g('unset multiplot')
+
--- /dev/null
+++ b/python.old/aubio/task/silence.py
@@ -1,0 +1,28 @@
+from aubio.task.task import task
+from aubio.aubioclass import *
+
+class tasksilence(task):
+	wassilence = 1
+	issilence  = 1
+	def __call__(self):
+		task.__call__(self)
+		if (aubio_silence_detection(self.myvec(),self.params.silence)==1):
+			if self.wassilence == 1: self.issilence = 1
+			else: self.issilence = 2
+			self.wassilence = 1
+		else: 
+			if self.wassilence <= 0: self.issilence = 0
+			else: self.issilence = -1 
+			self.wassilence = 0
+		if self.issilence == -1:
+			return max(self.frameread-self.params.delay,0.), -1
+		elif self.issilence == 2:
+			return max(self.frameread+self.params.delay,0.), 2 
+
+	def fprint(self,foo):
+		print self.params.step*foo[0],
+		if foo[1] == 2: print "OFF"
+		else: print "ON"
+
+
+
--- /dev/null
+++ b/python.old/aubio/task/task.py
@@ -1,0 +1,53 @@
+from aubio.aubioclass import * 
+from params import taskparams
+
+class task(taskparams):
+	""" default template class to apply tasks on a stream """
+	def __init__(self,input,output=None,params=None):
+		""" open the input file and initialize default argument 
+		parameters should be set *before* calling this method.
+		"""
+		import time
+		self.tic = time.time()
+		if params == None: self.params = taskparams()
+		else: self.params = params
+		self.frameread = 0
+		self.readsize  = self.params.hopsize
+		self.input     = input
+		self.filei     = sndfile(self.input)
+		self.srate     = self.filei.samplerate()
+		self.params.step = float(self.params.hopsize)/float(self.srate)
+		self.myvec     = fvec(self.params.hopsize)
+		self.output    = output
+
+	def __call__(self):
+		self.readsize = self.filei.read(self.params.hopsize,self.myvec)
+		self.frameread += 1
+		
+	def compute_all(self):
+		""" Compute data """
+    		mylist    = []
+		while(self.readsize==self.params.hopsize):
+			tmp = self()
+			if tmp: 
+				mylist.append(tmp)
+				if self.params.verbose:
+					self.fprint(tmp)
+    		return mylist
+	
+	def fprint(self,foo):
+		print foo
+
+	def eval(self,results):
+		""" Eval data """
+		pass
+
+	def plot(self):
+		""" Plot data """
+		pass
+
+	def time(self):
+		import time
+		#print "CPU time is now %f seconds," % time.clock(),
+		#print "task execution took %f seconds" % (time.time() - self.tic)
+		return time.time() - self.tic
--- /dev/null
+++ b/python.old/aubio/txtfile.py
@@ -1,0 +1,47 @@
+"""Copyright (C) 2004 Paul Brossier <[email protected]>
+print aubio.__LICENSE__ for the terms of use
+"""
+
+__LICENSE__ = """\
+  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
+
+  This file is part of aubio.
+
+  aubio is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  aubio is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
+"""            
+
+def read_datafile(filename,depth=-1):
+    """read list data from a text file (columns of float)"""
+    if filename == '--' or filename == '-':
+        import sys
+        fres = sys.stdin
+    else:
+        fres = open(filename,'ro')
+    l = []
+    while 1:
+        tmp = fres.readline()
+        if not tmp : break
+        else: tmp = tmp.split()
+        if depth > 0:
+            for i in range(min(depth,len(tmp))):
+                tmp[i] = float(tmp[i])
+            l.append(tmp)
+        elif depth == 0:
+            l.append(float(tmp[0]))
+        else:
+            for i in range(len(tmp)):
+                tmp[i] = float(tmp[i])
+            l.append(tmp)
+    return l
+
--- /dev/null
+++ b/python.old/aubio/web/browser.py
@@ -1,0 +1,167 @@
+ #
+ # Copyright 2004 Apache Software Foundation 
+ # 
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
+ # may not use this file except in compliance with the License.  You
+ # may obtain a copy of the License at
+ #
+ #      http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ # implied.  See the License for the specific language governing
+ # permissions and limitations under the License.
+ #
+ # Originally developed by Gregory Trubetskoy.
+ #
+ # $Id: publisher.py,v 1.36 2004/02/16 19:47:27 grisha Exp $
+
+"""
+  This handler is conceputally similar to Zope's ZPublisher, except
+  that it:
+
+  1. Is written specifically for mod_python and is therefore much faster
+  2. Does not require objects to have a documentation string
+  3. Passes all arguments as simply string
+  4. Does not try to match Python errors to HTTP errors
+  5. Does not give special meaning to '.' and '..'.
+
+  This is a modified version of mod_python.publisher.handler Only the first
+  directory argument is matched, the rest is left for path_info. A default
+  one must be provided.
+
+"""
+
+from mod_python import apache
+from mod_python import util
+from mod_python.publisher import resolve_object,process_auth,imp_suffixes
+
+import sys
+import os
+import re
+
+from types import *
+
+def configure_handler(req,default):
+
+    req.allow_methods(["GET", "POST"])
+    if req.method not in ["GET", "POST"]:
+        raise apache.SERVER_RETURN, apache.HTTP_METHOD_NOT_ALLOWED
+
+    func_path = ""
+    if req.path_info:
+        func_path = req.path_info[1:] # skip first /
+        #func_path = func_path.replace("/", ".")
+        #if func_path[-1:] == ".":
+        #    func_path = func_path[:-1] 
+        # changed: only keep the first directory
+        func_path = re.sub('/.*','',func_path)
+
+    # default to 'index' if no path_info was given
+    if not func_path:
+        func_path = "index"
+
+    # if any part of the path begins with "_", abort
+    if func_path[0] == '_' or func_path.count("._"):
+        raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
+
+    ## import the script
+    path, module_name =  os.path.split(req.filename)
+    if not module_name:
+        module_name = "index"
+
+    # get rid of the suffix
+    #   explanation: Suffixes that will get stripped off
+    #   are those that were specified as an argument to the
+    #   AddHandler directive. Everything else will be considered
+    #   a package.module rather than module.suffix
+    exts = req.get_addhandler_exts()
+    if not exts:
+        # this is SetHandler, make an exception for Python suffixes
+        exts = imp_suffixes
+    if req.extension:  # this exists if we're running in a | .ext handler
+        exts += req.extension[1:] 
+    if exts:
+        suffixes = exts.strip().split()
+        exp = "\\." + "$|\\.".join(suffixes)
+        suff_matcher = re.compile(exp) # python caches these, so its fast
+        module_name = suff_matcher.sub("", module_name)
+
+    # import module (or reload if needed)
+    # the [path] argument tells import_module not to allow modules whose
+    # full path is not in [path] or below.
+    config = req.get_config()
+    autoreload=int(config.get("PythonAutoReload", 1))
+    log=int(config.get("PythonDebug", 0))
+    try:
+        module = apache.import_module(module_name,
+                                      autoreload=autoreload,
+                                      log=log,
+                                      path=[path])
+    except ImportError:
+        et, ev, etb = sys.exc_info()
+        # try again, using default module, perhaps this is a
+        # /directory/function (as opposed to /directory/module/function)
+        func_path = module_name
+        module_name = "index"
+        try:
+            module = apache.import_module(module_name,
+                                          autoreload=autoreload,
+                                          log=log,
+                                          path=[path])
+        except ImportError:
+            # raise the original exception
+            raise et, ev, etb
+        
+    # does it have an __auth__?
+    realm, user, passwd = process_auth(req, module)
+
+    # resolve the object ('traverse')
+    try:
+        object = resolve_object(req, module, func_path, realm, user, passwd)
+    except AttributeError:
+        # changed, return the default path instead
+        #raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
+        object = default
+    # not callable, a class or an unbound method
+    if (not callable(object) or 
+        type(object) is ClassType or
+        (hasattr(object, 'im_self') and not object.im_self)):
+
+        result = str(object)
+        
+    else:
+        # callable, (but not a class or unbound method)
+        
+        # process input, if any
+        req.form = util.FieldStorage(req, keep_blank_values=1)
+        
+        result = util.apply_fs_data(object, req.form, req=req)
+
+    if result or req.bytes_sent > 0 or req.next:
+        
+        if result is None:
+            result = ""
+        else:
+            result = str(result)
+
+        # unless content_type was manually set, we will attempt
+        # to guess it
+        if not req._content_type_set:
+            # make an attempt to guess content-type
+            if result[:100].strip()[:6].lower() == '<html>' \
+               or result.find('</') > 0:
+                req.content_type = 'text/html'
+            else:
+                req.content_type = 'text/plain'
+
+        if req.method != "HEAD":
+            req.write(result)
+        else:
+            req.write("")
+        return apache.OK
+    else:
+        req.log_error("mod_python.publisher: %s returned nothing." % `object`)
+        return apache.HTTP_INTERNAL_SERVER_ERROR
+
--- /dev/null
+++ b/python.old/aubio/web/html.py
@@ -1,0 +1,286 @@
+from aubio.bench.node import *
+
+def parse_args(req):
+    req.basehref = BASEHREF
+    req.datadir = DATADIR
+    if req.path_info: path_info = req.path_info
+    else: path_info = '/'
+    location = re.sub('^/show_[a-z0-9]*/','',path_info)
+    location = re.sub('^/play_[a-z0-9]*/','',location)
+    location = re.sub('^/index/','',location)
+    location = re.sub('^/','',location)
+    location = re.sub('/$','',location)
+    datapath = "%s/%s" % (DATADIR,location)
+    respath  = "%s/%s" % (DATADIR,location)
+    last     = re.sub('/$','',location)
+    last     = last.split('/')[-1]
+    first    = path_info.split('/')[1]
+    # store some of this in the mp_request
+    req.location, req.datapath, req.respath = location, datapath, respath
+    req.first, req.last = first, last
+
+    if location:
+        if not (os.path.isfile(datapath) or 
+		os.path.isdir(datapath) or 
+		location in ['feedback','email']):
+		# the path was not understood
+		from mod_python import apache
+		req.write("<html> path not found %s</html>" % (datapath))
+		raise apache.SERVER_RETURN, apache.OK
+		#from mod_python import apache
+		#raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
+
+def navigation(req):
+    """ main html navigation header """
+    from mod_python import psp
+    req.content_type = "text/html"
+    parse_args(req)
+    datapath = req.datapath
+    location = req.location
+
+    # deal with session
+    if req.sess.is_new():
+	    msg = "<b>Welcome %s</b><br>" % req.sess['login']
+    else:
+	    msg = "<b>Welcome back %s</b><br>" % req.sess['login']
+
+    # start writing
+    tmpl = psp.PSP(req, filename='header.tmpl')
+    tmpl.run(vars = { 'title': "aubioweb / %s / %s" % (req.first,location),
+    		'basehref': '/~piem/',
+		'message': msg,
+    		'action': req.first})
+
+    req.write("<h2>Content of ")
+    print_link(req,"","/")
+    y = location.split('/')
+    for i in range(len(y)-1): 
+    	print_link(req,"/".join(y[:i+1]),y[i])
+	req.write(" / ")
+    req.write("%s</h2>\n" % y[-1])
+
+    a = {'show_info' : 'info',
+    	 'show_sound': 'waveform',
+    	 'show_onset': 'onset',
+    	 'index'     : 'index',
+	 'show_pitch': 'pitch',
+	 'play_m3u': 'stream (m3u/ogg)',
+	 'play_ogg': 'save (ogg)',
+	 'play_wav': 'save (wav)',
+	 }
+
+    # print task lists (only remaining tasks)
+    print_link(req,re.sub('%s.*'%req.last,'',location),"go up")
+    akeys = a.keys(); akeys.sort();
+    curkey = req.first
+    for akey in akeys: 
+        if akey != curkey:
+    		req.write(":: ")
+		print_link(req,"/".join((akey,location)),a[akey])
+	else:
+    		req.write(":: ")
+		req.write("<b>%s</b>" % a[akey])
+    req.write("<br>")
+
+    # list the content of the directories
+    listdir,listfiles = [],[]
+    if os.path.isdir(datapath):
+        listfiles = list_snd_files(datapath)
+    	listdir = list_dirs(datapath)
+	listdir.pop(0) # kick the current dir
+    elif os.path.isfile(datapath):
+        listfiles = [datapath]
+	listdir = [re.sub(req.last,'',location)]
+
+    link_list(req,listdir,title="Subdirectories")
+    link_list(req,listfiles,title="Files")
+
+def footer(req):
+    """ html navigation footer """
+    from mod_python import psp
+    tmpl = psp.PSP(req, filename='footer.tmpl')
+    tmpl.run(vars = { 'time': -req.mtime+req.request_time })
+
+def apply_on_data(req, func,**keywords):
+    # bug: hardcoded snd file filter
+    act_on_data(func,req.datapath,req.respath,
+    	filter="f  -maxdepth 1 -name '*.wav' -o -name '*.aif'",**keywords)
+
+def print_link(req,target,name,basehref=BASEHREF):
+    req.write("<a href='%s/%s'>%s</a>\n" % (basehref,target,name))
+
+def print_img(req,target,name='',basehref=BASEHREF):
+    if name == '': name = target
+    req.write("<img src='%s/%s' alt='%s' title='%s'>\n" % (basehref,target,name,name))
+
+def link_list(req,targetlist,basehref=BASEHREF,title=None):
+    if len(targetlist) > 1:
+        if title: req.write("<h3>%s</h3>"%title)
+        req.write('<ul>')
+        for i in targetlist:
+            s = re.split('%s/'%DATADIR,i,maxsplit=1)[1]
+            if s: 
+        	req.write('<li>')
+	    	print_link(req,s,s)
+        	req.write('</li>')
+        req.write('</ul>')
+
+def print_list(req,list):
+    req.write("<pre>\n")
+    for i in list: req.write("%s\n" % i)
+    req.write("</pre>\n")
+
+def print_command(req,command):
+    req.write("<h4>%s</h4>\n" % re.sub('%%','%',command))
+    def print_runcommand(input,output):
+        cmd = re.sub('(%)?%i','%s' % input, command)
+        cmd = re.sub('(%)?%o','%s' % output, cmd)
+        print_list(req,runcommand(cmd))
+    apply_on_data(req,print_runcommand)
+
+def datapath_to_location(input):
+    location = re.sub(DATADIR,'',input)
+    return re.sub('^/*','',location)
+
+## drawing hacks
+def draw_func(req,func):
+    import re
+    req.content_type = "image/png"
+    # build location (strip the func_path, add DATADIR)
+    location = re.sub('^/draw_[a-z]*/','%s/'%DATADIR,req.path_info)
+    location = re.sub('.png$','',location)
+    if not os.path.isfile(location):
+	from mod_python import apache
+	raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
+    # replace location in func
+    cmd = re.sub('(%)?%i','%s' % location, func)
+    # add PYTHONPATH at the beginning, 
+    cmd = "%s%s 2> /dev/null" % (PYTHONPATH,cmd)
+    for each in runcommand(cmd):
+	req.write("%s\n"%each)
+
+def show_task(req,task):
+    def show_task_file(input,output,task):
+        location = datapath_to_location(input)
+        print_img(req,"draw_%s/%s" % (task,location))
+    navigation(req)
+    req.write("<h3>%s</h3>\n" % task)
+    apply_on_data(req,show_task_file,task=task)
+    footer(req)
+
+## waveform_foo
+def draw_sound(req):
+    draw_func(req,"aubioplot-audio %%i stdout 2> /dev/null")
+
+def show_sound(req):
+    show_task(req,"sound")
+
+## pitch foo
+def draw_pitch(req,threshold='0.3'):
+    draw_func(req,"aubiopitch -i %%i -p -m schmitt,yin,fcomb,mcomb -t %s -O stdout" % threshold)
+
+def show_pitch(req):
+    show_task(req,"pitch")
+
+## onset foo
+def draw_onset(req,threshold='0.3'):
+    draw_func(req,"aubiocut -i %%i -p -m complex -t %s -O stdout" % threshold)
+
+def show_onset(req,threshold='0.3',details=''):
+    def onset_file(input,output):
+        location = datapath_to_location(input)
+        print_img(req,"draw_onset/%s?threshold=%s"%(location,threshold))
+        print_link(req,"?threshold=%s" % (float(threshold)-0.1),"-")
+        req.write("%s\n" % threshold)
+        print_link(req,"?threshold=%s" % (float(threshold)+0.1),"+")
+	# bug: hardcoded sndfile extension 
+        anote = re.sub('\.wav$','.txt',input)
+	if anote == input: anote = ""
+        res = get_extract(input,threshold)
+        if os.path.isfile(anote):
+            tru = get_anote(anote)
+            print_list(req,get_results(tru,res,0.05))
+        else:
+            req.write("no ground truth found<br>\n")
+        if details:
+            req.write("<h4>Extraction</h4>\n")
+            print_list(req,res)
+        else:
+            req.write("<a href='%s/show_onset/%s?details=yes&amp;threshold=%s'>details</a><br>\n" %
+            	(req.basehref,location,threshold))
+        if details and os.path.isfile(anote):
+            req.write("<h4>Computed differences</h4>\n")
+            ldiffs = get_diffs(tru,res,0.05)
+            print_list(req,ldiffs)
+            req.write("<h4>Annotations</h4>\n")
+            print_list(req,tru)
+    navigation(req)
+    req.write("<h3>Onset</h3>\n")
+    apply_on_data(req,onset_file)
+    footer(req)
+
+def get_anote(anote):
+    import aubio.onsetcompare
+    # FIXME: should import with txtfile.read_datafile
+    return aubio.onsetcompare.load_onsets(anote)
+
+def get_diffs(anote,extract,tol):
+    import aubio.onsetcompare
+    return aubio.onsetcompare.onset_diffs(anote,extract,tol)
+
+def get_extract(datapath,threshold='0.3'):
+    cmd = "%saubiocut -v -m complex -t %s -i %s" % (PYTHONPATH,threshold,datapath)
+    lo = runcommand(cmd)
+    for i in range(len(lo)): lo[i] = float(lo[i])
+    return lo
+
+def get_results(anote,extract,tol):
+    import aubio.onsetcompare
+    orig, missed, merged, expc, bad, doubled = aubio.onsetcompare.onset_roc(anote,extract,tol)
+    s =("GD %2.8f\t"        % (100*float(orig-missed-merged)/(orig)),
+        "FP %2.8f\t"        % (100*float(bad+doubled)/(orig))       , 
+        "GD-merged %2.8f\t" % (100*float(orig-missed)/(orig))       , 
+        "FP-pruned %2.8f\t" % (100*float(bad)/(orig))		    )
+    return s
+
+# play m3u foo
+def play_m3u(req):
+    def show_task_file(input,output,task):
+        location = datapath_to_location(input)
+        req.write("http://%s%s/play_ogg/%s\n" % (HOSTNAME,BASEHREF,re.sub("play_m3u",task,location)))
+    req.content_type = "audio/mpegurl"
+    parse_args(req)
+    apply_on_data(req,show_task_file,task="play_ogg")
+
+# play wav foo
+def play_wav(req):
+    req.content_type = "audio/x-wav"
+    func = "cat %%i"
+    # build location (strip the func_path, add DATADIR)
+    location = re.sub('^/play_wav/','%s/'%DATADIR,req.path_info)
+    if not os.path.isfile(location):
+	from mod_python import apache
+	raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
+    # replace location in func
+    cmd = re.sub('(%)?%i','%s' % location, func)
+    # add PYTHONPATH at the beginning, 
+    cmd = "%s 2> /dev/null" % cmd
+    for each in runcommand(cmd):
+	req.write("%s\n"%each)
+
+# play ogg foo
+def play_ogg(req):
+    req.content_type = "application/ogg"
+    func = "oggenc -o - %%i"
+    # build location (strip the func_path, add DATADIR)
+    location = re.sub('^/play_ogg/','%s/'%DATADIR,req.path_info)
+    location = re.sub('.ogg$','',location)
+    if not os.path.isfile(location):
+	from mod_python import apache
+	raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
+    # replace location in func
+    cmd = re.sub('(%)?%i','%s' % location, func)
+    # add PYTHONPATH at the beginning, 
+    cmd = "%s 2> /dev/null" % cmd
+    for each in runcommand(cmd):
+	req.write("%s\n"%each)
--- /dev/null
+++ b/python.old/aubio/wscript_build
@@ -1,0 +1,17 @@
+# vim:set syntax=python:
+
+pyaubio = ctx.new_task_gen(name = 'python-aubio',
+  features = 'c cshlib pyext',
+  source = '../../swig/aubio.i',
+  add_objects = 'sndfileio',
+  target = '_aubiowrapper',
+  use = ['aubio'],
+  uselib = ['SNDFILE'],
+  swig_flags = '-python -Wall',
+  includes = '. ../../src ../../examples')
+pyaubio.install_path = '${PYTHONDIR}/${PACKAGE}'
+
+# install python files 
+ctx.install_files('${PYTHONDIR}/${PACKAGE}/', ctx.path.ant_glob('**/*.py'))
+# install swig generated python file
+ctx.install_files('${PYTHONDIR}/${PACKAGE}/', '../../swig/aubiowrapper.py')
--- /dev/null
+++ b/python.old/aubiocompare-onset
@@ -1,0 +1,114 @@
+#! /usr/bin/python
+
+"""Copyright (C) 2004 Paul Brossier <[email protected]>
+
+print aubio.__LICENSE__ for the terms of use
+
+or see LICENSE.txt in the aubio installation directory.
+"""
+__LICENSE__ = """\
+  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
+
+  This file is part of aubio.
+
+  aubio is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  aubio is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
+"""            
+
+
+__HELP__ = """\
+# required arguments
+ -c targetfilename 
+ -o detectfilename 
+(both must be text files with 1 time a line expressed in seconds)
+
+# optional arguments
+ -D <delay>  	delay in seconds
+ -v 		verbose mode
+ -d 		debug mode
+
+# output 
+results:number of correct detections
+        number of incorrect detections
+        number of doubled detections
+        number of total detections
+        number of total targets
+
+# example:
+$ aubioonset-comp -c checked-onsets.txt -o handlab-onsets.txt -v
+( gd fp dd ) tot / real
+( 5 4 0 ) 9 / 9
+55.5555555556 %GD       44.4444444444 %FP       0.0 %OD
+
+# bugs
+does not scale to very long lists
+"""
+
+import sys
+from aubio.onsetcompare import onset_roc, onset_diffs
+from aubio.txtfile import read_datafile
+
+# default values
+fileo=None;filec=None;vmode=None;dmode=None;delay=0.
+# default tolerance is 50 ms
+#tol = 0.050
+tol = 0.048
+# default mode is onset
+mode = 'onset'
+
+while len(sys.argv) >=2:
+    option = sys.argv[1]; del sys.argv[1]
+    if option == '-h': print __HELP__; sys.exit()
+    if option == '-o': fileo = sys.argv[1]; del sys.argv[1]
+    if option == '-c': filec = sys.argv[1]; del sys.argv[1]
+    if option == '-v': vmode = 'verbose'
+    if option == '-d': dmode = 'debug'
+    if option == '-D': delay = float(sys.argv[1]); del sys.argv[1] 
+    if option == '-tol': tol = float(sys.argv[1]); del sys.argv[1] 
+    if option == '-l': mode = 'localisation'
+
+# arguments required
+if (not fileo) or (not filec):
+    print 'wrong set of arguments. use \'-h\' for help' 
+    sys.exit('error: needs at least \'-c targets.txt -o detected.txt\'')
+
+# load files
+ltru, lres = read_datafile(fileo,depth=0),read_datafile(filec,depth=0)
+
+# delay onsets as required with -D
+if delay:
+    for i in range(len(lres)):
+        lres[i] = lres[i] + delay
+# compute errors types
+if mode == 'localisation':
+	l = onset_diffs(ltru,lres,tol)
+	for i in l: print "%.3f" % i
+else:
+	orig, missed, merged, expc, bad, doubled = onset_roc(ltru,lres,tol)
+	
+	# print results
+	#print "orig, missed, merged, expc, bad, doubled:"
+	if vmode=='verbose':
+	    print "orig", orig
+            print "expc", expc
+            print "missed",missed
+            print "merged", merged
+            print "bad", bad
+            print "doubled", doubled
+            print "correct", orig-missed-merged
+	    print "GD %2.8f\t"        % (100*float(orig-missed-merged)/(orig)),
+	    print "FP %2.8f\t"        % (100*float(bad+doubled)/(orig))       , 
+	    print "GD-merged %2.8f\t" % (100*float(orig-missed)/(orig))       , 
+	    print "FP-pruned %2.8f\t" % (100*float(bad)/(orig))                
+	else:
+	    print  orig, missed, merged, expc, bad, doubled
--- /dev/null
+++ b/python.old/aubiocut
@@ -1,0 +1,156 @@
+#! /usr/bin/python
+
+""" this file was written by Paul Brossier 
+  it is released under the GNU/GPL license.
+"""
+
+import sys
+from aubio.task import *
+
+usage = "usage: %s [options] -i soundfile" % sys.argv[0]
+
+def parse_args():
+        from optparse import OptionParser
+        parser = OptionParser(usage=usage)
+        parser.add_option("-i","--input",
+                          action="store", dest="filename", 
+                          help="input sound file")
+        parser.add_option("-m","--mode", 
+			  action="store", dest="mode", default='dual', 
+                          help="onset detection mode [default=dual] \
+                          complexdomain|hfc|phase|specdiff|energy|kl|mkl|dual")
+        parser.add_option("-B","--bufsize",
+                          action="store", dest="bufsize", default=512, 
+                          help="buffer size [default=512]")
+        parser.add_option("-H","--hopsize",
+                          action="store", dest="hopsize", default=256, 
+                          help="overlap size [default=256]")
+        parser.add_option("-t","--threshold",
+                          action="store", dest="threshold", default=0.3, 
+                          help="onset peak picking threshold [default=0.3]")
+        parser.add_option("-C","--dcthreshold",
+                          action="store", dest="dcthreshold", default=1., 
+                          help="onset peak picking DC component [default=1.]")
+        parser.add_option("-s","--silence",
+                          action="store", dest="silence", default=-70, 
+                          help="silence threshold [default=-70]")
+        parser.add_option("-M","--mintol",
+                          action="store", dest="mintol", default=0.048, 
+                          help="minimum inter onset interval [default=0.048]")
+        parser.add_option("-D","--delay",
+                          action="store", dest="delay",  
+                          help="number of seconds to take back [default=system]\
+                          default system delay is 3*hopsize/samplerate")
+        parser.add_option("-L","--localmin",
+                          action="store_true", dest="localmin", default=False, 
+                          help="use local minima after peak detection")
+        parser.add_option("-c","--cut",
+                          action="store_true", dest="cut", default=False,
+                          help="cut input sound file at detected labels \
+                          best used with option -L")
+        parser.add_option("-d","--derivate",
+                          action="store_true", dest="derivate", default=False, 
+                          help="derivate onset detection function")
+        parser.add_option("-S","--silencecut",
+                          action="store_true", dest="silencecut", default=False,
+                          help="outputs silence locations")
+        parser.add_option("-z","--zerocross",
+                          action="store", dest="zerothres", default=0.008, 
+                          help="zero-crossing threshold for slicing [default=0.00008]")
+        # plotting functions
+        parser.add_option("-p","--plot",
+                          action="store_true", dest="plot", default=False, 
+                          help="draw plot")
+        parser.add_option("-x","--xsize",
+                          action="store", dest="xsize", default=1., 
+                          type='float', help="define xsize for plot")
+        parser.add_option("-y","--ysize",
+                          action="store", dest="ysize", default=1., 
+                          type='float', help="define ysize for plot")
+        parser.add_option("-f","--function",
+                          action="store_true", dest="func", default=False, 
+                          help="print detection function")
+        parser.add_option("-n","--no-onsets",
+                          action="store_true", dest="nplot", default=False, 
+                          help="do not plot detected onsets")
+        parser.add_option("-O","--outplot",
+                          action="store", dest="outplot", default=None, 
+                          help="save plot to output.{ps,png}")
+        parser.add_option("-F","--spectrogram",
+                          action="store_true", dest="spectro", default=False,
+                          help="add spectrogram to the plot")
+        parser.add_option("-v","--verbose",
+                          action="store_true", dest="verbose", default=True,
+                          help="make lots of noise [default]")
+        parser.add_option("-q","--quiet",
+                          action="store_false", dest="verbose", default=True, 
+                          help="be quiet")
+        # to be implemented
+        parser.add_option("-b","--beat",
+                          action="store_true", dest="beat", default=False,
+                          help="output beat locations")
+        (options, args) = parser.parse_args()
+        if not options.filename: 
+                 print "no file name given\n", usage
+                 sys.exit(1)
+        return options, args
+
+options, args = parse_args()
+
+filename   = options.filename
+params = taskparams()
+params.hopsize    = int(options.hopsize)
+params.bufsize    = int(options.bufsize)
+params.threshold  = float(options.threshold)
+params.dcthreshold = float(options.dcthreshold)
+params.zerothres  = float(options.zerothres)
+params.silence    = float(options.silence)
+params.mintol     = float(options.mintol)
+params.verbose    = options.verbose
+# default take back system delay
+if options.delay: params.delay = int(float(options.delay)/params.step)
+
+dotask = taskonset
+if options.beat:
+	dotask = taskbeat
+elif options.silencecut:
+	dotask = tasksilence
+elif options.plot or options.func: 
+	params.storefunc=True
+else:              
+	params.storefunc=False
+
+lonsets, lofunc = [], []
+wplot,oplots = [],[]
+modes = options.mode.split(',')
+for i in range(len(modes)):
+	params.onsetmode = modes[i] 
+	filetask = dotask(filename,params=params)
+	onsets = filetask.compute_all()
+
+        #lonsets.append(onsets)
+	if not options.silencecut:
+		ofunc = filetask.ofunc
+		lofunc.append(ofunc)
+
+	if options.plot:
+		if options.beat: 
+			filetask.plot(oplots, onsets)
+		else:
+			filetask.plot(onsets, ofunc, wplot, oplots, nplot=options.nplot)
+
+	if options.func: 
+		for i in ofunc: 
+			print i 
+
+if options.outplot:
+  extension = options.outplot.split('.')[-1] 
+  outplot = '.'.join(options.outplot.split('.')[:-1])
+else:
+  extension,outplot = None,None
+if options.plot: filetask.plotplot(wplot, oplots, outplot=outplot, extension=extension,
+  xsize=options.xsize,ysize=options.ysize,spectro=options.spectro)
+
+if options.cut:
+        a = taskcut(filename,onsets,params=params)
+	a.compute_all()
--- /dev/null
+++ b/python.old/aubiodiffs-onset
@@ -1,0 +1,86 @@
+#! /usr/bin/python
+
+__LICENSE__ = """\
+  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
+
+  This file is part of aubio.
+
+  aubio is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  aubio is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
+"""            
+
+__HELP__ = """\
+# required arguments
+ -c targetfilename 
+ -o detectfilename 
+(both must be text files with 1 time a line expressed in seconds)
+
+# optional arguments
+ -D <delay>  	delay in seconds
+ -v 		verbose mode
+ -d 		debug mode
+
+# output 
+results:number of correct detections
+        number of incorrect detections
+        number of doubled detections
+        number of total detections
+        number of total targets
+
+# example:
+$ aubioonset-comp -c checked-onsets.txt -o handlab-onsets.txt -v
+( gd fp dd ) tot / real
+( 5 4 0 ) 9 / 9
+55.5555555556 %GD       44.4444444444 %FP       0.0 %OD
+
+# bugs
+does not scale to very long lists
+"""
+
+import sys
+from aubio.onsetcompare import onset_diffs
+from aubio.txtfile import read_datafile
+
+# default values
+fileo=None;filec=None;vmode=None;dmode=None;delay=0.
+# default tolerance is 50 ms
+#tol = 0.050
+tol = 0.048
+
+while len(sys.argv) >=2:
+    option = sys.argv[1]; del sys.argv[1]
+    if option == '-h': print __HELP__; sys.exit()
+    if option == '-o': fileo = sys.argv[1]; del sys.argv[1]
+    if option == '-c': filec = sys.argv[1]; del sys.argv[1]
+    if option == '-v': vmode = 'verbose'
+    if option == '-d': dmode = 'debug'
+    if option == '-D': delay = float(sys.argv[1]); del sys.argv[1] 
+    if option == '-tol': tol = float(sys.argv[1]); del sys.argv[1] 
+
+# arguments required
+if (not fileo) or (not filec):
+    print 'wrong set of arguments. use \'-h\' for help' 
+    sys.exit('error: needs at least \'-c targets.txt -o detected.txt\'')
+
+# load files
+ltru, lres = read_datafile(fileo,depth=0),read_datafile(filec,depth=0)
+
+# delay onsets as required with -D
+if delay:
+    for i in range(len(lres)):
+        lres[i] = lres[i] + delay
+# compute errors types
+l = onset_diffs(ltru,lres,tol)
+# print with 1ms precision
+for i in l: print "%.3f" % float(i)
+
--- /dev/null
+++ b/python.old/aubiofilter-notes
@@ -1,0 +1,94 @@
+#!/usr/bin/python
+
+"""  this file is used to get filter the (old) output format of aubionotes """
+
+# default parameters 
+__eps       = [0.250,0.50]      # minimum length, pitch tolerance (ms,midipitch)
+__plot      = 0                 # -P (command line switch)
+__delay     = 0.0               # -D <value> (fixed delay for score alignement)
+__winlength = 10                # -w <value> (window length for pitch estimation in frames)
+
+import getopt
+import sys
+
+def parse_args (sysargs):
+        from getopt import gnu_getopt
+        shortopts ='i:o:t:p:w:D:P:'
+        longopts =('input=','output=','tolpitch=','toltime=','winlength=','delay','plot=')
+        args,tmp = gnu_getopt(sysargs,shortopts,longopts)
+        assert len(args) > 1
+        plot      = __plot
+        delay     = __delay
+        eps       = __eps
+        winlength = __winlength
+        plot = __plot
+        fileout   = '/tmp/testprint.ps'
+        args.sort()
+        for i in range(len(args)):  # a bad way
+                if args[i][0] == '-i' or args[i][0] == '--input':
+                        fileorg =  args[i][1]
+                if args[i][0] == '-o' or args[i][0] == '--output':
+                        fileerr =  args[i][1]
+                if args[i][0] == '-t' or args[i][0] == '--toltime':
+                        eps[0] = float(args[i][1])
+                if args[i][0] == '-p' or args[i][0] == '--tolpitch':
+                        eps[1] = float(args[i][1])
+                if args[i][0] == '-D' or args[i][0] == '--delay':
+                        delay = float(args[i][1])
+                if args[i][0] == '-w' or args[i][0] == '--winlength':
+                        winlength = int(args[i][1])
+                if args[i][0] == '-P' or args[i][0] == '--plot':
+                        plot = 1
+                        fileout = args[i][1]
+        return fileorg,fileerr,eps,winlength,plot,delay,fileout
+
+def usage():
+        print __file__, "with at least some arguments"
+
+def main(): 
+        try:
+                opts,args = getopt.getopt(sys.argv[1:], 
+                        "hvo:i:p:P", 
+                        ["help", "output=", "verbose", "input=", "plot="])
+        except getopt.GetoptError:
+                usage()
+                sys.exit(2)
+
+        input = None
+        output = None
+        verbose = False
+        winlength = __winlength
+        plot = __plot
+        eps = __eps
+
+        for o, a in opts:
+                if o in ("-v", "--verbose"):
+                        verbose = True
+                if o in ("-h", "--help"):
+                        usage()
+                        sys.exit(2)
+                if o in ("--output"):
+                        output = a
+                if o in ("-i", "--input"):
+                        input = a
+                if o in ("-P", "--plot"):
+                        plot = 1
+
+        assert input != None and input != "", "no input file" 
+
+        from aubio import notefilter,txtfile,gnuplot
+        """ load midi and raw data """
+        from numpy import array
+        notelist = array(txtfile.read_datafile(input))
+        """ filter it out """
+        notelist_filtered = notefilter.segraw_onsets4(notelist,winlength,eps)
+        if verbose == 1 : 
+                for a,b in notelist_filtered:
+                        print a,b
+        """ plot results """
+        if plot == 1  : 
+                gnuplot.plotnote(notelist_filtered,title=input,fileout=output)
+        
+if __name__ == "__main__":
+        main()
+
--- /dev/null
+++ b/python.old/aubionotes
@@ -1,0 +1,79 @@
+#!/usr/bin/python
+
+def do(filein,threshold):
+
+    import aubio.aubioclass
+    import aubio.median
+    from math import floor
+    hopsize   = 512
+    bufsize   = 4096
+    channels  = 1
+    frameread = 0
+    silthres  = -80.
+    filei     = aubio.aubioclass.sndfile(filein)
+    srate     = filei.samplerate()
+    myvec     = aubio.aubioclass.fvec(hopsize,channels)
+    readsize  = filei.read(hopsize,myvec)
+    ppick     = aubio.aubioclass.pitchpick(bufsize,hopsize,channels,myvec,srate)
+    opick     = aubio.aubioclass.onsetpick(bufsize,hopsize,channels,myvec,threshold)
+    mylist    = list()
+
+    wassilence = 0
+    lastpitch = 0
+    starttime = 0
+    while(readsize==hopsize):
+        readsize = filei.read(hopsize,myvec)
+        val = ppick.do(myvec)
+        midival = aubio.aubioclass.bintomidi(val,srate,bufsize) 
+        isonset,onset = opick.do(myvec) 
+        now = (frameread)*hopsize/(srate+0.)
+        issilence = aubio.aubioclass.aubio_silence_detection(myvec.vec,silthres)
+        
+        estmidival = 0
+        if (issilence == 1):
+            if (wassilence == 0):
+                #outputnow
+                endtime = (frameread-3)*hopsize/(srate+0.)
+                if len(mylist) > 5 :
+                    estmidival = aubio.median.percental(mylist,len(mylist)/2)
+                    print "sil", starttime, endtime, estmidival
+                #resetnow
+                mylist = list()
+            else:
+                wassilence = 1
+        else:
+            if isonset == 1:
+                if (wassilence == 0):
+                    #outputnow
+                    endtime = (frameread-3)*hopsize/(srate+0.)
+                    #estmidival = aubio.median.percental(around(array(mylist)),len(mylist)//2)
+                    if len(mylist) > 5 :
+                        estmidival = aubio.median.percental(mylist,len(mylist)/2)
+                        print starttime, endtime, estmidival
+                #resetnow
+                mylist = list()
+                #store start time
+                starttime = (frameread-3)*hopsize/(srate+0.)
+            else:
+                """
+                if(listfull):
+                    #outputnow
+                    endtime = (frameread-3)*hopsize/(srate+0.)
+                    print starttime, endtime, estimmidival
+                else:
+                """
+                #bufferize
+                if midival > 50 and midival < 75:
+                    mylist.append(floor(midival))
+            wassilence = 0
+                    
+            
+        #elif( midival > 45 ):
+        #    mylist.append(( now , midival+12 ))
+        #mylist.append(toappend)
+        frameread += 1
+
+
+if __name__ == "__main__":
+    import sys
+    do(sys.argv[1],sys.argv[2])
--- /dev/null
+++ b/python.old/aubiopitch
@@ -1,0 +1,131 @@
+#!/usr/bin/python
+
+""" this file was written by Paul Brossier 
+  it is released under the GNU/GPL license.
+"""
+
+import sys
+from aubio.task import *
+
+usage = "usage: %s [options] -i soundfile" % sys.argv[0]
+
+
+def parse_args():
+  from optparse import OptionParser
+  parser = OptionParser(usage=usage)
+  parser.add_option("-i","--input",
+      action="store", dest="filename", 
+      help="input sound file")
+  parser.add_option("-m","--mode", 
+      action="store", dest="mode", default='yinfft',
+      help="pitch detection mode [default=mcomb] \
+      mcomb|yin|fcomb|schmitt")
+  parser.add_option("-u","--units",
+      action="store", dest="omode", default="freq",
+      help="output pitch in units [default=Hz] \
+      freq|midi|cent|bin")
+  parser.add_option("-B","--bufsize",
+      action="store", dest="bufsize", default=None, 
+      help="buffer size [default=2048]")
+  parser.add_option("-H","--hopsize",
+      action="store", dest="hopsize", default=None, 
+      help="overlap size [default=512]")
+  parser.add_option("-t","--threshold",
+      action="store", dest="threshold", default=0.1, 
+      help="pitch threshold (for yin) [default=0.1]")
+  parser.add_option("-s","--silence",
+      action="store", dest="silence", default=-70, 
+      help="silence threshold [default=-70]")
+  parser.add_option("-D","--delay",
+      action="store", dest="delay",  
+      help="number of seconds frames to take back [default=0]")
+  parser.add_option("-S","--smoothing",
+      action="store", dest="smoothing", default=False, 
+      help="use a median filter of N frames [default=0]")
+  parser.add_option("-M","--maximum",
+      action="store", dest="pitchmax", default=False, 
+      help="maximum pitch value to look for (Hz) [default=20000]")
+  parser.add_option("-l","--minimum",
+      action="store", dest="pitchmin", default=False, 
+      help="minimum pitch value to look for (Hz) [default=20]")
+  # to be implemented
+  parser.add_option("-n","--note",
+      action="store_true", dest="note", default=False,
+      help="NOT IMPLEMENTED output notes")
+  # plotting functions
+  parser.add_option("-T","--plottruth",
+      action="store_true", dest="plottruth", default=False, 
+      help="draw plot of the ground truth pitch track")
+  parser.add_option("-p","--plot",
+      action="store_true", dest="plot", default=False, 
+      help="draw plot of the pitch track")
+  parser.add_option("-x","--xsize",
+      action="store", dest="xsize", default=1., 
+      type='float', help="define xsize for plot")
+  parser.add_option("-y","--ysize",
+      action="store", dest="ysize", default=1., 
+      type='float', help="define ysize for plot")
+  parser.add_option("-O","--outplot",
+      action="store", dest="outplot", default=None, 
+      help="save the plot to output.{ps,png,svg} instead of displaying it")
+  parser.add_option("-v","--verbose",
+      action="store_true", dest="verbose", default=True,
+      help="make lots of noise")
+  parser.add_option("-q","--quiet",
+      action="store_false", dest="verbose", default=True, 
+      help="be quiet")
+  (options, args) = parser.parse_args()
+  if not options.bufsize:
+    if options.mode == "yin":     options.bufsize = 1024
+    if options.mode == "schmitt": options.bufsize = 2048
+    if options.mode == "mcomb":   options.bufsize = 4096
+    if options.mode == "fcomb":   options.bufsize = 4096 
+    else: options.bufsize = 2048
+  if not options.hopsize:
+    options.hopsize = float(options.bufsize) / 2
+  if not options.filename: 
+    print "no file name given\n", usage
+    sys.exit(1)
+  return options, args
+
+options, args = parse_args()
+
+#print options.bufsize, options.hopsize
+
+filename   = options.filename
+params = taskparams()
+params.samplerate = float(sndfile(filename).samplerate())
+params.hopsize    = int(options.hopsize)
+params.bufsize    = int(options.bufsize)
+params.step       = params.samplerate/float(params.hopsize)
+params.yinthresh  = float(options.threshold)
+params.silence    = float(options.silence)
+params.verbose    = options.verbose
+if options.smoothing: params.pitchsmooth = int(options.smoothing)
+if options.pitchmax:  params.pitchmax    = int(options.pitchmax)
+if options.pitchmin:  params.pitchmin    = int(options.pitchmin)
+#mintol     = float(options.mintol)*step
+# default take back system delay
+if options.delay: params.pitchdelay = float(options.delay)
+
+if options.note:
+        exit("not implemented yet")
+
+wplot,oplots,titles = [],[],[]
+modes = options.mode.split(',')
+for i in range(len(modes)):
+	pitch = []
+	params.pitchmode  = modes[i]
+	filetask = taskpitch(filename,params=params)
+	pitch = filetask.compute_all()
+	#print filetask.eval(pitch[i]) 
+	if options.plot: filetask.plot(pitch,wplot,oplots,titles)
+
+if options.outplot:
+  extension = options.outplot.split('.')[-1] 
+  outplot = '.'.join(options.outplot.split('.')[:-1])
+else:
+  extension,outplot = None,None
+if options.plot: 
+	filetask.plotplot(wplot,oplots,titles,outplot=outplot,extension=extension,
+  xsize=options.xsize,ysize=options.ysize,truth=options.plottruth)
--- /dev/null
+++ b/python.old/aubioplot-audio
@@ -1,0 +1,31 @@
+#!/usr/bin/python
+
+import sys
+from aubio.gnuplot import gnuplot_create,gnuplot_addargs,plot_audio
+
+usage = "usage: %s [options] -i soundfile" % sys.argv[0]
+
+def parse_args():
+        from optparse import OptionParser
+        parser = OptionParser(usage=usage)
+        parser.add_option("-i","--input",
+                          action="store", dest="filename", 
+                          help="input sound file")
+        gnuplot_addargs(parser)
+        (options, args) = parser.parse_args()
+        if not options.filename: 
+                 print "no file name given\n", usage
+                 sys.exit(1)
+        return options, args
+
+options, args = parse_args()
+
+if options.outplot: 
+  extension = options.outplot.split('.')[-1] 
+  outplot = '.'.join(options.outplot.split('.')[:-1])
+else: 
+  extension = ''
+  outplot = None
+
+g = gnuplot_create(outplot,extension,options)
+plot_audio(options.filename.split(','), g, options)
--- /dev/null
+++ b/python.old/aubioplot-notes
@@ -1,0 +1,31 @@
+#!/usr/bin/python
+
+def parse_args (sysargs):
+        from getopt import gnu_getopt
+        shortopts ='i:o:'
+        longopts =('input=','output=')
+        args,tmp = gnu_getopt(sysargs,shortopts,longopts)
+        args.sort()
+        filein,fileout= None,None
+        for i in range(len(args)):  # a bad way
+                if args[i][0] == '-i' or args[i][0] == '--input':
+                        filein =  args[i][1]
+                if args[i][0] == '-o' or args[i][0] == '--output':
+                        fileout =  args[i][1]
+        assert filein != None, 'precise filein'
+        return filein,fileout
+
+def main (sysargs) :
+    from aubio.txtfile import read_datafile
+    from aubio.gnuplot import plotnote,plotnote_do 
+    from numpy import array
+    filein,fileout = parse_args(sysargs)
+    #print 'checking', fileerr, 'against', fileorg
+    """ load midi and raw data """
+    d = plotnote(array(read_datafile(filein)),title=filein)
+    plotnote_do(d,fileout=fileout)
+
+if __name__ == "__main__":
+    import sys 
+    main(sys.argv[1:])
+
--- /dev/null
+++ b/python.old/aubioplot-spec
@@ -1,0 +1,51 @@
+#! /usr/bin/python
+
+""" this file was written by Paul Brossier 
+  it is released under the GNU/GPL license.
+"""
+
+import sys
+from aubio.gnuplot import gnuplot_create,gnuplot_addargs,plot_spec 
+
+usage = "usage: %s [options] -i soundfile" % sys.argv[0]
+
+def parse_args():
+        from optparse import OptionParser
+        parser = OptionParser(usage=usage)
+        parser.add_option("-i","--input",
+                          action="store", dest="filename", 
+                          help="input sound file")
+        parser.add_option("-M","--maxf",
+                          action="store", dest="maxf", default=10000., 
+                          type='float',help="higher frequency limit")
+        parser.add_option("-L","--minf",
+                          action="store", dest="minf", default=0., 
+                          type='float',help="lower frequency limit")
+        parser.add_option("-l","--log",
+                          action="store_true", dest="log", default=False, 
+                          help="plot on a logarithmic scale")
+        parser.add_option("-B","--bufsize", type='int',
+                          action="store", dest="bufsize", default=8192, 
+                          help="buffer size [default=8192]")
+        parser.add_option("-H","--hopsize", type='int',
+                          action="store", dest="hopsize", default=1024, 
+                          help="overlap size [default=1024]")
+        gnuplot_addargs(parser)
+        (options, args) = parser.parse_args()
+        if not options.filename: 
+                 print "no file name given\n", usage
+                 sys.exit(1)
+        return options, args
+
+options, args = parse_args()
+filename = options.filename
+
+if options.outplot: 
+  extension = options.outplot.split('.')[-1] 
+  outplot = '.'.join(options.outplot.split('.')[:-1])
+else: 
+  extension = ''
+  outplot = None
+
+g = gnuplot_create(outplot,extension,options)
+plot_spec(filename, g, options)
--- /dev/null
+++ b/python.old/aubioplot-yinfft
@@ -1,0 +1,135 @@
+#! /usr/bin/python
+
+""" this file was written by Paul Brossier 
+  it is released under the GNU/GPL license.
+"""
+
+import sys,time
+from aubio.task import task,taskparams
+from aubio.aubioclass import fvec
+from aubio.gnuplot import gnuplot_create
+from aubio.aubiowrapper import *
+
+usage = "usage: %s [options] -i soundfile" % sys.argv[0]
+
+def parse_args():
+        from optparse import OptionParser
+        parser = OptionParser(usage=usage)
+        parser.add_option("-i","--input",
+                          action="store", dest="filename", 
+                          help="input sound file")
+        parser.add_option("-n","--printframe",
+                          action="store", dest="printframe", default=-1, 
+                          help="make a plot of the n_th frame")
+        parser.add_option("-x","--xsize",
+                          action="store", dest="xsize", default=1., 
+                          help="define xsize for plot")
+        parser.add_option("-y","--ysize",
+                          action="store", dest="ysize", default=1., 
+                          help="define ysize for plot")
+        parser.add_option("-O","--outplot",
+                          action="store", dest="outplot", default=None, 
+                          help="save plot to output.{ps,png}")
+        (options, args) = parser.parse_args()
+        if not options.filename: 
+                 print "no file name given\n", usage
+                 sys.exit(1)
+        return options, args
+
+def plotdata(x,y,plottitle="",**keyw):
+	import Gnuplot
+	return Gnuplot.Data(x, y, title="%s" % plottitle,**keyw)
+
+options, args = parse_args()
+filename = options.filename
+xsize = float(options.xsize)
+ysize = float(options.ysize)*2
+
+printframe = int(options.printframe)
+if printframe == -1:
+  print "Will wait for ^D to skip to next plot"
+  print "Press enter before to print to file"
+
+
+g = gnuplot_create()
+params = taskparams()
+params.hopsize = 2048 # 512 
+params.bufsize = params.hopsize #2048
+taskfile = task(filename,params=params)
+
+yin = fvec(params.bufsize/2,1)
+
+t = [i for i in range(params.bufsize)]
+a = [0 for i in range(params.bufsize)]
+
+while (taskfile.readsize == params.hopsize):
+  taskfile()
+
+  n = [i for i in range(params.bufsize/2)]
+  a = [taskfile.myvec.get(i,0) for i in range(params.hopsize/2)]
+  aubio_pitchyin_diff(taskfile.myvec(),yin()) # compute d[t]
+  c = [yin.get(i,0) for i in range(params.bufsize/2)]
+  aubio_pitchyin_getcum(yin()) # compute d'[t]
+  y = [yin.get(i,0) for i in range(params.bufsize/2)]
+  thresh = [0.1 for i in range(params.bufsize/2)]
+  #t.append((i/float(params.hopsize)+taskfile.frameread)*params.step),t.pop(0)
+  d = [plotdata(n,a,plottitle="signal", with_='lines'),
+    plotdata(n,c,plottitle="d[t]",axes='x1y2', with_='lines lt 1'),
+    plotdata(n,y,plottitle="d'[t]",axes='x1y1', with_='lines lt 2'),
+    plotdata(n,thresh,plottitle="threshold",axes='x1y1', with_='lines lt 3')]
+  #g('set xrange [%f:%f]' % (t[0],t[-1]))
+  #time.sleep(.2)
+  g.reset()
+  g('set yrange [-1:3]')
+  g('set xrange [0:%d]' % (params.bufsize/2))
+  g('set title \"%s\"' %  "Example of period detection using YIN")
+  if printframe == -1:
+    g.replot(*d)
+    a = sys.stdin.read()
+  if a == "\n" or printframe == taskfile.frameread:
+      from os.path import basename
+      outplot = "_".join([basename(sys.argv[0]),'_'.join(basename(filename).split('.')),"%d" % taskfile.frameread])
+      print outplot
+      f = gnuplot_create(outplot=outplot,extension='ps')
+      f('set size %f,%f;' % (xsize,ysize) )
+      f('set lmargin %f' % (15*xsize))
+      f('set rmargin %f' % (10*xsize))
+      #f('set title \"%s\"' %  "Example of period detection using YIN")
+      f('set multiplot')
+      f.ylabel('amplitude',offset=(+.5,0))
+      f.xlabel('time (samples)')
+      f('set size %f,%f;' % (xsize,ysize*0.4) )
+      f('set orig %f,%f;' % (0,ysize*0.6) )
+      sigmax = max(abs(min(a)),abs(max(a)))
+      f('set yrange [%f:%f]' % (-1.3*sigmax,1.3*sigmax))
+      f('set xrange [0:%d]' % (params.bufsize/2))
+      f.plot(d[0])
+
+      f.ylabel('')
+      f.xlabel('lag (samples)')
+      f('set bmargin %f' % (4*ysize))
+      f('set size %f,%f;' % (xsize,ysize*0.6) )
+      f('set orig %f,%f;' % (0,0) )
+      f('set autoscale')
+      f('set xrange [0:%d]' % (params.bufsize/2))
+      f('set notitle')
+      f('set y2tics')
+      f('set ytics nomirror')
+      f('set noytics')
+      f('set key right')
+      f.plot(d[1])
+
+      f.ylabel('amplitude')
+      f.xlabel('')
+      f('set y2tics nomirror')
+      f('set ytics nomirror')
+      f('set noy2tics')
+      f('set noxtics')
+      f('set ytics')
+      f('set key left')
+      f.plot(d[2],d[3])
+      #f('set yrange [-1:3]')
+      #f.plot(*d)
+      print "saved plot", outplot, 'ps'
+  elif printframe < taskfile.frameread:
+      break
--- /dev/null
+++ b/python.old/aubioweb.py
@@ -1,0 +1,113 @@
+#!/usr/bin/python
+
+doc = """
+This script works with mod_python to browse a collection of annotated wav files
+and results.
+
+you will need to have at least the following packages need to be installed (the
+name of the command line tool is precised in parenthesis):
+
+libapache-mod-python (apache2 prefered)
+sndfile-programs (sndfile-info)
+vorbis-tools (oggenc)
+python-gnuplot
+python-numpy
+
+Try the command line tools in aubio/python to test your installation.
+
+NOTE: this script is probably horribly insecure.
+
+example configuration for apache to put in your preferred virtual host.
+
+<Directory /home/piem/public_html/aubioweb>
+    # Minimal config
+    AddHandler mod_python .py
+    # Disable these in production
+    PythonDebug On
+    PythonAutoReload on
+    # Default handler in url
+    PythonHandler aubioweb
+    ## Authentication stuff (optional)
+    #PythonAuthenHandler aubioweb
+    #AuthType Basic
+    #AuthName "Restricted Area"
+    #require valid-user
+    # make default listing
+    DirectoryIndex aubioweb/
+</Directory>
+
+"""
+
+from aubio.web.html import *
+
+def handler(req):
+    from aubio.web.browser import *
+    from mod_python import Session
+    req.sess = Session.Session(req)
+    req.sess['login']='new aubio user'
+    req.sess.save()
+    return configure_handler(req,index)
+
+def index(req,threshold='0.3'):
+    navigation(req)
+    print_command(req,"sfinfo %%i")
+    return footer(req)
+
+def show_info(req,verbose=''):
+    navigation(req)
+    print_command(req,"sndfile-info %%i")
+    return footer(req)
+
+def feedback(req):
+    navigation(req)
+    req.write("""
+    Please provide feedback below:
+  <p>                           
+  <form action="/~piem/aubioweb/email" method="POST">
+      Name:    <input type="text" name="name"><br>
+      Email:   <input type="text" name="email"><br>
+      Comment: <textarea name="comment" rows=4 cols=20></textarea><br>
+      <input type="submit">
+  </form>
+    """)
+
+WEBMASTER='piem@calabaza'
+SMTP_SERVER='localhost'
+
+def email(req,name,email,comment):
+    import smtplib
+    # make sure the user provided all the parameters
+    if not (name and email and comment):
+        return "A required parameter is missing, \
+               please go back and correct the error"
+    # create the message text
+    msg = """\
+From: %s                                                                                                                                           
+Subject: feedback
+To: %s
+
+I have the following comment:
+
+%s
+
+Thank You,
+
+%s
+
+""" % (email, WEBMASTER, comment, name)
+    # send it out
+    conn = smtplib.SMTP(SMTP_SERVER)
+    try:
+	conn.sendmail(email, [WEBMASTER], msg)
+    except smtplib.SMTPSenderRefused:
+	return """<html>please provide a valid email</html>"""
+	
+    conn.quit()
+    # provide feedback to the user
+    s = """\
+<html>
+Dear %s,<br>
+Thank You for your kind comments, we
+will get back to you shortly.
+</html>""" % name
+    return s
--- /dev/null
+++ b/python.old/bench-cluster-test
@@ -1,0 +1,9 @@
+#! /usr/bin/python
+
+from aubio.bench.broadcast import *
+
+run_broadcast(remote_sync,'/home/testing')
+run_broadcast(remote_sync,'/home/testing','-n')
+run_broadcast(fetch_results,'/home/testing','-n')
+
+run_broadcast(remote_queue,'echo coucou')
--- /dev/null
+++ b/python.old/bench-test
@@ -1,0 +1,13 @@
+#! /usr/bin/python
+
+from aubio.bench.node import *
+
+datapath = '/var/www'
+respath = '/var/tmp'
+
+def my_print(input,output):
+        cmd = "%s %s %s" % ("time sleep 0.3; echo",input,output)
+        return runcommand(cmd,debug=0)
+
+act_on_results(mkdir,datapath,respath,filter='d')
+act_on_data(my_print,datapath,respath,suffix='.txt')
--- /dev/null
+++ b/python.old/wscript_build
@@ -1,0 +1,6 @@
+# vim:set syntax=python:
+
+ctx.add_subdirs('aubio')
+# install headers
+for file in ['aubiocut', 'aubiopitch']:
+  ctx.install_as('${PREFIX}/bin/' + file, file, chmod = 0755)
--- a/python/README
+++ /dev/null
@@ -1,30 +1,0 @@
-# Here you will find some examples of python scripts and some evaluation
-# routines. The python interface for libaubio is generated using Swig.
-
-# To have it working before installation, you will need to set LD_LIBRARY_PATH.
-# for instance, to run the python script from within aubio/python/, you can use
-# '. README'
-
-export LD_LIBRARY_PATH=../src/.libs:../ext/.libs
-export PYTHONPATH=aubio/.libs
-
-echo """
-
-the aubio/ directory should be organised as follow:
-
- aubiowrapper.py,_aubiowrapper.so, aubio_wrap.c, aubio_wrap.o
- 	swig generated aubio interface 
- aubioclass.py
- 	human usable interface
- plot/
- 	everything required to plot
- web/
- 	tools to use aubioweb.py
- bench/
- 	tools to explore a database of sound file and run benchmarks on it
- eval/
- 	tools to evaluate the performance of aubio extractors
- aubioweb.py
- 	a hack to pipe aubio in mod_python
- 
-"""
--- a/python/aubio/__init__.py
+++ /dev/null
@@ -1,28 +1,0 @@
-"""Copyright (C) 2004 Paul Brossier <[email protected]>
-print aubio.__LICENSE__ for the terms of use
-"""
-
-__LICENSE__ = """\
-  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
-
-  This file is part of aubio.
-
-  aubio is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  aubio is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
-"""            
-
-#from aubioclass import *
-#from onsetcompare import *
-#from median import *
-#from noteroc import *
-#from txtfile import *
--- a/python/aubio/aubioclass.py
+++ /dev/null
@@ -1,160 +1,0 @@
-from aubiowrapper import *
-
-class fvec:
-    def __init__(self,size):
-        self.vec = new_fvec(size)
-    def __call__(self):
-        return self.vec
-    def __del__(self):
-        del_fvec(self())
-    def get(self,pos):
-        return fvec_read_sample(self(),pos)
-    def set(self,value,pos):
-        return fvec_write_sample(self(),value,pos)
-    def data(self):
-        return fvec_get_data(self())
-
-class cvec:
-    def __init__(self,size):
-        self.vec = new_cvec(size)
-    def __call__(self):
-        return self.vec
-    def __del__(self):
-        del_cvec(self())
-    def get(self,pos):
-        return self.get_norm(pos)
-    def set(self,val,pos):
-        self.set_norm(val,pos)
-    def get_norm(self,pos):
-        return cvec_read_norm(self(),pos)
-    def set_norm(self,val,pos):
-        cvec_write_norm(self(),val,pos)
-    def get_phas(self,pos):
-        return cvec_read_phas(self(),pos)
-    def set_phas(self,val,pos):
-        cvec_write_phas(self(),val,pos)
-
-class sndfile:
-    def __init__(self,filename,model=None):
-        if (model!=None):
-            self.file = new_aubio_sndfile_wo(model.file,filename)
-        else:
-            self.file = new_aubio_sndfile_ro(filename)
-        if self.file == None:
-            raise IOError, "failed opening file %s" % filename
-    def __del__(self):
-        if self.file != None: del_aubio_sndfile(self.file)
-    def info(self):
-        aubio_sndfile_info(self.file)
-    def samplerate(self):
-        return aubio_sndfile_samplerate(self.file)
-    def channels(self):
-        return aubio_sndfile_channels(self.file)
-    def read(self,nfram,vecread):
-        return aubio_sndfile_read_mono(self.file,nfram,vecread())
-    def write(self,nfram,vecwrite):
-        return aubio_sndfile_write(self.file,nfram,vecwrite())
-
-class pvoc:
-    def __init__(self,buf,hop):
-        self.pv = new_aubio_pvoc(buf,hop)
-    def __del__(self):
-        del_aubio_pvoc(self.pv)
-    def do(self,tf,tc):
-        aubio_pvoc_do(self.pv,tf(),tc())
-    def rdo(self,tc,tf):
-        aubio_pvoc_rdo(self.pv,tc(),tf())
-
-class onsetdetection:
-    """ class for aubio_specdesc """
-    def __init__(self,mode,buf):
-        self.od = new_aubio_specdesc(mode,buf)
-    def do(self,tc,tf):
-        aubio_specdesc_do(self.od,tc(),tf())
-    def __del__(self):
-        del_aubio_specdesc(self.od)
-
-class peakpick:
-    """ class for aubio_peakpicker """
-    def __init__(self,threshold=0.1):
-        self.pp = new_aubio_peakpicker()
-        self.out = new_fvec(1)
-        aubio_peakpicker_set_threshold (self.pp, threshold)
-    def do(self,fv):
-        aubio_peakpicker_do(self.pp, fv(), self.out)
-        return fvec_read_sample(self.out, 0)
-    def getval(self):
-        return aubio_peakpicker_get_adaptive_threshold(self.pp)
-    def __del__(self):
-        del_aubio_peakpicker(self.pp)
-
-class onsetpick:
-    """ superclass for aubio_pvoc + aubio_specdesc + aubio_peakpicker """
-    def __init__(self,bufsize,hopsize,myvec,threshold,mode='dual',derivate=False,dcthreshold=0):
-        self.myfft    = cvec(bufsize)
-        self.pv       = pvoc(bufsize,hopsize)
-        if mode in ['dual'] :
-                self.myod     = onsetdetection("hfc",bufsize)
-                self.myod2    = onsetdetection("mkl",bufsize)
-                self.myonset  = fvec(1)
-                self.myonset2 = fvec(1)
-        else: 
-                self.myod     = onsetdetection(mode,bufsize)
-                self.myonset  = fvec(1)
-        self.mode     = mode
-        self.pp       = peakpick(float(threshold))
-        self.derivate = derivate
-        self.dcthreshold = dcthreshold 
-        self.oldval   = 0.
-
-    def do(self,myvec): 
-        self.pv.do(myvec,self.myfft)
-        self.myod.do(self.myfft,self.myonset)
-        if self.mode == 'dual':
-           self.myod2.do(self.myfft,self.myonset2)
-           self.myonset.set(self.myonset.get(0)*self.myonset2.get(0),0)
-        if self.derivate:
-           val         = self.myonset.get(0)
-           dval        = val - self.oldval
-           self.oldval = val
-           if dval > 0: self.myonset.set(dval,0)
-           else:  self.myonset.set(0.,0,0)
-        isonset, dval = self.pp.do(self.myonset),self.myonset.get(0)
-        if self.dcthreshold:
-           if dval < self.dcthreshold: isonset = 0 
-        return isonset, dval
-
-class pitch:
-    def __init__(self,mode="mcomb",bufsize=2048,hopsize=1024,
-        samplerate=44100.,omode="freq",tolerance=0.1):
-        self.pitchp = new_aubio_pitch(mode,bufsize,hopsize,
-            samplerate)
-        self.mypitch = fvec(1)
-        aubio_pitch_set_unit(self.pitchp,omode)
-        aubio_pitch_set_tolerance(self.pitchp,tolerance)
-        #self.filt     = filter(srate,"adsgn")
-    def __del__(self):
-        del_aubio_pitch(self.pitchp)
-    def __call__(self,myvec): 
-        aubio_pitch_do(self.pitchp,myvec(), self.mypitch())
-        return self.mypitch.get(0)
-
-class filter:
-    def __init__(self,srate,type=None):
-        if (type=="adsgn"):
-            self.filter = new_aubio_adsgn_filter(srate)
-    def __del__(self):
-        #del_aubio_filter(self.filter)
-        pass
-    def __call__(self,myvec):
-        aubio_filter_do(self.filter,myvec())
-
-class beattracking:
-    """ class for aubio_beattracking """
-    def __init__(self,winlen,channels):
-        self.p = new_aubio_beattracking(winlen,channels)
-    def do(self,dfframe,out):
-        return aubio_beattracking_do(self.p,dfframe(),out())
-    def __del__(self):
-        del_aubio_beattracking(self.p)
-
--- a/python/aubio/bench/broadcast.py
+++ /dev/null
@@ -1,25 +1,0 @@
-from config import *
-
-class run_broadcast:
-        def __init__(self,command,*args):
-                for host in REMOTEHOSTS:
-                        command(host,args[0],args[1:])
-
-def remote_sync(host,path='',options=''):
-        optstring = ''
-        for i in options:
-                optstring = "%s %s" % (optstring,i)
-        print RSYNC_CMD,optstring,RSYNC_OPT,' --delete', 
-        print '%s%s%s%s%s' % (path,'/ ',host,':',path)
-
-
-def fetch_results(host,path='',options=''):
-        optstring = ''
-        for i in options:
-                optstring = "%s %s" % (optstring,i)
-        print RSYNC_CMD,optstring,RSYNC_OPT,' --update', 
-        print '%s%s%s%s%s' % (host,':',path,'/ ',path)
-
-def remote_queue(host,command,options=''):
-        print 'oarsub -p "hostname = \'',host,'\'',command
-        
--- a/python/aubio/bench/config.py
+++ /dev/null
@@ -1,22 +1,0 @@
-
-filefound = 0
-try:
-        filename = "/etc/aubio-bench.conf"
-        execfile(filename)
-        filefound = 1
-except IOError:
-        print "no system wide configuration file found in", filename
-
-try:
-        import os
-        filename = "%s%s%s" % (os.getenv('HOME'),os.sep,".aubio-bench.conf")
-        execfile(filename)
-        filefound = 1
-except IOError:
-        #print "no user configuration file found in", filename
-	pass
-
-if filefound == 0:
-        import sys
-        print "error: no configuration file found at all"
-        sys.exit(1)
--- a/python/aubio/bench/node.py
+++ /dev/null
@@ -1,224 +1,0 @@
-from config import *
-import commands,sys
-import re
-
-def runcommand(cmd,debug=0):
-        if VERBOSE >= VERBOSE_CMD or debug: print cmd
-        if debug: return 
-        status, output = commands.getstatusoutput(cmd)
-        if status == 0 or VERBOSE >= VERBOSE_OUT:
-                output = output.split('\n')
-        if VERBOSE >= VERBOSE_OUT: 
-                for i in output: 
-                        if i: print i
-        if not status == 0: 
-                print 'error:',status,output
-                print 'command returning error was',cmd
-                #sys.exit(1)
-	if output == '' or output == ['']: return
-        return output 
-
-def list_files(datapath,filter='f', maxdepth = -1):
-	if not os.path.exists(datapath):
-		print
-		print "ERR: no directory %s were found" % datapath
-		sys.exit(1)
-	if maxdepth >= 0: maxstring = " -maxdepth %d " % maxdepth	
-	else: maxstring = ""
-        cmd = '%s' * 6 % ('find ',datapath,maxstring,' -type ',filter, "| sort -n")
-        return runcommand(cmd)
-
-def list_wav_files(datapath,maxdepth = -1):
-	return list_files(datapath, filter="f -name '*.wav'",maxdepth = maxdepth)
-
-sndfile_filter = "f -name '*.wav' -o -name '*.aif' -o -name '*.aiff'"
-
-def list_snd_files(datapath,maxdepth = -1):
-	return list_files(datapath, filter=sndfile_filter, 
-		maxdepth = maxdepth)
-
-def list_res_files(datapath,maxdepth = -1):
-	return list_files(datapath, filter="f -name '*.txt'", maxdepth = maxdepth)
-
-def list_dirs(datapath):
-	return list_files(datapath, filter="d")
-
-def mkdir(path):
-        cmd = '%s%s' % ('mkdir -p ',path)
-        return runcommand(cmd)
-
-def act_on_data (action,datapath,respath=None,suffix='.txt',filter='f',sub='\.wav$',**keywords):
-        """ execute action(datafile,resfile) on all files in datapath """
-        dirlist = list_files(datapath,filter=filter)
-        if dirlist == ['']: dirlist = []
-        if respath:
-		respath_in_datapath = re.split(datapath, respath,maxsplit=1)[1:]
-        	if(respath_in_datapath and suffix == ''): 
-                	print 'error: respath in datapath and no suffix used'
-        for i in dirlist:
-                j = re.split(datapath, i,maxsplit=1)[1]
-                j = re.sub(sub,'',j)
-                #j = "%s%s%s"%(respath,j,suffix)
-		if respath:
-			j = "%s%s"%(respath,j)
-			if sub != '':
-				j = re.sub(sub,suffix,j)
-			else:
-				j = "%s%s" % (j,suffix)
-                action(i,j,**keywords)
-
-def act_on_results (action,datapath,respath,filter='d'):
-        """ execute action(respath) an all subdirectories in respath """
-        dirlist = list_files(datapath,filter='d')
-        respath_in_datapath = re.split(datapath, respath,maxsplit=1)[1:]
-        if(respath_in_datapath and not filter == 'd' and suffix == ''): 
-                print 'warning: respath is in datapath'
-        for i in dirlist:
-                s = re.split(datapath, i ,maxsplit=1)[1]
-                action("%s%s%s"%(respath,'/',s))
-
-def act_on_files (action,listfiles,listres=None,suffix='.txt',filter='f',sub='\.wav$',**keywords):
-        """ execute action(respath) an all subdirectories in respath """
-        if listres and len(listfiles) <= len(listres): 
-		for i in range(len(listfiles)):
-			action(listfiles[i],listres[i],**keywords)
-        else:
-		for i in listfiles:
-                	action(i,None,**keywords)
-
-class bench:
-	""" class to run benchmarks on directories """
-	def __init__(self,datadir,resdir=None,checkres=False,checkanno=False,params=[]):
-		from aubio.task.params import taskparams
-		self.datadir = datadir
-		# path to write results path to
-		self.resdir = resdir
-		# list of annotation files
-		self.reslist = []
-		# list used to gather results
-		self.results = []
-		if not params: self.params = taskparams()
-		else:          self.params = params
-		print "Checking data directory", self.datadir
-		self.checkdata()
-		if checkanno: self.checkanno()
-		if checkres: self.checkres()
-	
-	def checkdata(self):
-		if os.path.isfile(self.datadir):
-			self.dirlist = os.path.dirname(self.datadir)
-		elif os.path.isdir(self.datadir):
-			self.dirlist = list_dirs(self.datadir)
-		# allow dir* matching through find commands?
-		else:
-			print "ERR: path not understood"
-			sys.exit(1)
-		print "Listing directories in data directory",
-		if self.dirlist:
-			print " (%d elements)" % len(self.dirlist)
-		else:
-			print " (0 elements)"
-			print "ERR: no directory %s were found" % self.datadir
-			sys.exit(1)
-		print "Listing sound files in data directory",
-		self.sndlist = list_snd_files(self.datadir)
-		if self.sndlist:
-			print " (%d elements)" % len(self.sndlist)
-		else:
-			print " (0 elements)"
-			print "ERR: no sound files were found in", self.datadir
-			sys.exit(1)
-	
-	def checkanno(self):
-		print "Listing annotations in data directory",
-		self.reslist = list_res_files(self.datadir)
-		print " (%d elements)" % len(self.reslist)
-		#for each in self.reslist: print each
-		if not self.reslist or len(self.reslist) < len (self.sndlist):
-			print "ERR: not enough annotations"
-			return -1
-		else:
-			print "Found enough annotations"
-	
-	def checkres(self):
-		print "Creating results directory"
-		act_on_results(mkdir,self.datadir,self.resdir,filter='d')
-
-	def pretty_print(self,sep='|'):
-		for i in self.printnames:
-			print self.formats[i] % self.v[i], sep,
-		print
-
-	def pretty_titles(self,sep='|'):
-		for i in self.printnames:
-			print self.formats[i] % i, sep,
-		print
-
-	def dir_exec(self):
-		""" run file_exec on every input file """
-		self.l , self.labs = [], [] 
-		self.v = {}
-		for i in self.valuenames:
-			self.v[i] = [] 
-		for i in self.valuelists:
-			self.v[i] = [] 
-		act_on_files(self.file_exec,self.sndlist,self.reslist, \
-			suffix='',filter=sndfile_filter)
-
-	def dir_eval(self):
-		pass
-
-	def file_gettruth(self,input):
-		""" get ground truth filenames """
-		from os.path import isfile
-		ftrulist = []
-		# search for match as filetask.input,".txt" 
-		ftru = '.'.join(input.split('.')[:-1])
-		ftru = '.'.join((ftru,'txt'))
-		if isfile(ftru):
-			ftrulist.append(ftru)
-		else:
-			# search for matches for filetask.input in the list of results
-			for i in range(len(self.reslist)):
-				check = '.'.join(self.reslist[i].split('.')[:-1])
-				check = '_'.join(check.split('_')[:-1])
-				if check == '.'.join(input.split('.')[:-1]):
-					ftrulist.append(self.reslist[i])
-		return ftrulist
-
-	def file_exec(self,input,output):
-		""" create filetask, extract data, evaluate """
-		filetask = self.task(input,params=self.params)
-		computed_data = filetask.compute_all()
-		ftrulist = self.file_gettruth(filetask.input)
-		for i in ftrulist:
-			filetask.eval(computed_data,i,mode='rocloc',vmode='')
-			""" append filetask.v to self.v """
-			for i in self.valuenames:
-				self.v[i].append(filetask.v[i])
-			for j in self.valuelists:
-				if filetask.v[j]:
-					for i in range(len(filetask.v[j])):
-						self.v[j].append(filetask.v[j][i])
-	
-	def file_eval(self):
-		pass
-	
-	def file_plot(self):
-		pass
-
-	def dir_plot(self):
-		pass
-	
-	def run_bench(self):
-		for mode in self.modes:
-			self.params.mode = mode
-			self.dir_exec()
-			self.dir_eval()
-			self.dir_plot()
-
-	def dir_eval_print(self):
-		self.dir_exec()
-		self.dir_eval()
-		self.pretty_print()
-
--- a/python/aubio/bench/onset.py
+++ /dev/null
@@ -1,303 +1,0 @@
-
-from aubio.bench.node import *
-from os.path import dirname,basename
-
-def mmean(l):
-	return sum(l)/max(float(len(l)),1)
-
-def stdev(l):
-	smean = 0
-	if not len(l): return smean
-	lmean = mmean(l)
-	for i in l:
-		smean += (i-lmean)**2
-	smean *= 1. / len(l)
-	return smean**.5
-
-class benchonset(bench):
-
-	""" list of values to store per file """
-	valuenames = ['orig','missed','Tm','expc','bad','Td']
-	""" list of lists to store per file """
-	valuelists = ['l','labs']
-	""" list of values to print per dir """
-	printnames = [ 'mode', 'thres', 'dist', 'prec', 'recl',
-		'GD', 'FP', 
-		'Torig', 'Ttrue', 'Tfp',  'Tfn',  'TTm',   'TTd',
-		'aTtrue', 'aTfp', 'aTfn', 'aTm',  'aTd',  
-		'mean', 'smean',  'amean', 'samean']
-
-	""" per dir """
-	formats = {'mode': "%12s" , 'thres': "%5.4s", 
-		'dist':  "%5.4s", 'prec': "%5.4s", 'recl':  "%5.4s",
-		'Torig': "%5.4s", 'Ttrue': "%5.4s", 'Tfp':   "%5.4s", 'Tfn':   "%5.4s", 
-		'TTm':    "%5.4s", 'TTd':    "%5.4s",
-		'aTtrue':"%5.4s", 'aTfp':  "%5.4s", 'aTfn':  "%5.4s", 
-		'aTm':   "%5.4s", 'aTd':   "%5.4s",
-		'mean':  "%5.6s", 'smean': "%5.6s", 
-		'amean':  "%5.6s", 'samean': "%5.6s", 
-		"GD":     "%5.4s", "FP":     "%5.4s",
-		"GDm":     "%5.4s", "FPd":     "%5.4s",
-		"bufsize": "%5.4s", "hopsize": "%5.4s",
-		"time":   "%5.4s"}
-
-	def dir_eval(self):
-		""" evaluate statistical data over the directory """
-		v = self.v
-
-		v['mode']      = self.params.onsetmode
-		v['thres']     = self.params.threshold 
-		v['bufsize']   = self.params.bufsize
-		v['hopsize']   = self.params.hopsize
-		v['silence']   = self.params.silence
-		v['mintol']   = self.params.mintol
-
-		v['Torig']     = sum(v['orig'])
-		v['TTm']       = sum(v['Tm'])
-		v['TTd']       = sum(v['Td'])
-		v['Texpc']     = sum(v['expc'])
-		v['Tbad']      = sum(v['bad'])
-		v['Tmissed']   = sum(v['missed'])
-		v['aTm']       = mmean(v['Tm'])
-		v['aTd']       = mmean(v['Td'])
-
-		v['mean']      = mmean(v['l'])
-		v['smean']     = stdev(v['l'])
-
-		v['amean']     = mmean(v['labs'])
-		v['samean']    = stdev(v['labs'])
-		
-		# old type calculations
-		# good detection rate 
-		v['GD']  = 100.*(v['Torig']-v['Tmissed']-v['TTm'])/v['Torig']
-		# false positive rate
-		v['FP']  = 100.*(v['Tbad']+v['TTd'])/v['Torig']
-		# good detection counting merged detections as good
-		v['GDm'] = 100.*(v['Torig']-v['Tmissed'])/v['Torig'] 
-		# false positives counting doubled as good
-		v['FPd'] = 100.*v['Tbad']/v['Torig']                
-		
-		# mirex type annotations
-		totaltrue = v['Texpc']-v['Tbad']-v['TTd']
-		totalfp = v['Tbad']+v['TTd']
-		totalfn = v['Tmissed']+v['TTm']
-		self.v['Ttrue']     = totaltrue
-		self.v['Tfp']       = totalfp
-		self.v['Tfn']       = totalfn
-		# average over the number of annotation files
-		N = float(len(self.reslist))
-		self.v['aTtrue']    = totaltrue/N
-		self.v['aTfp']      = totalfp/N
-		self.v['aTfn']      = totalfn/N
-
-		# F-measure
-		self.P = 100.*float(totaltrue)/max(totaltrue + totalfp,1)
-		self.R = 100.*float(totaltrue)/max(totaltrue + totalfn,1)
-		#if self.R < 0: self.R = 0
-		self.F = 2.* self.P*self.R / max(float(self.P+self.R),1)
-		self.v['dist']      = self.F
-		self.v['prec']      = self.P
-		self.v['recl']      = self.R
-
-
-	"""
-	Plot functions 
-	"""
-
-	def plotroc(self,d,plottitle=""):
-		import Gnuplot, Gnuplot.funcutils
-		gd = []
-		fp = []
-		for i in self.vlist:
-			gd.append(i['GD']) 
-			fp.append(i['FP']) 
-		d.append(Gnuplot.Data(fp, gd, with_='linespoints', 
-			title="%s %s" % (plottitle,i['mode']) ))
-
-	def plotplotroc(self,d,outplot=0,extension='ps'):
-		import Gnuplot, Gnuplot.funcutils
-		from sys import exit
-		g = Gnuplot.Gnuplot(debug=0, persist=1)
-		if outplot:
-			if   extension == 'ps':  ext, extension = '.ps' , 'postscript'
-			elif extension == 'png': ext, extension = '.png', 'png'
-			elif extension == 'svg': ext, extension = '.svg', 'svg'
-			else: exit("ERR: unknown plot extension")
-			g('set terminal %s' % extension)
-			g('set output \'roc-%s%s\'' % (outplot,ext))
-		xmax = 30 #max(fp)
-		ymin = 50 
-		g('set xrange [0:%f]' % xmax)
-		g('set yrange [%f:100]' % ymin)
-		# grid set
-		g('set grid')
-		g('set xtics 0,5,%f' % xmax)
-		g('set ytics %f,5,100' % ymin)
-		g('set key 27,65')
-		#g('set format \"%g\"')
-		g.title(basename(self.datadir))
-		g.xlabel('false positives (%)')
-		g.ylabel('correct detections (%)')
-		g.plot(*d)
-
-	def plotpr(self,d,plottitle=""):
-		import Gnuplot, Gnuplot.funcutils
-		x = []
-		y = []
-		for i in self.vlist:
-			x.append(i['prec']) 
-			y.append(i['recl']) 
-		d.append(Gnuplot.Data(x, y, with_='linespoints', 
-			title="%s %s" % (plottitle,i['mode']) ))
-
-	def plotplotpr(self,d,outplot=0,extension='ps'):
-		import Gnuplot, Gnuplot.funcutils
-		from sys import exit
-		g = Gnuplot.Gnuplot(debug=0, persist=1)
-		if outplot:
-			if   extension == 'ps':  ext, extension = '.ps' , 'postscript'
-			elif extension == 'png': ext, extension = '.png', 'png'
-			elif extension == 'svg': ext, extension = '.svg', 'svg'
-			else: exit("ERR: unknown plot extension")
-			g('set terminal %s' % extension)
-			g('set output \'pr-%s%s\'' % (outplot,ext))
-		g.title(basename(self.datadir))
-		g.xlabel('Recall (%)')
-		g.ylabel('Precision (%)')
-		g.plot(*d)
-
-	def plotfmeas(self,d,plottitle=""):
-		import Gnuplot, Gnuplot.funcutils
-		x,y = [],[]
-		for i in self.vlist:
-			x.append(i['thres']) 
-			y.append(i['dist']) 
-		d.append(Gnuplot.Data(x, y, with_='linespoints', 
-			title="%s %s" % (plottitle,i['mode']) ))
-
-	def plotplotfmeas(self,d,outplot="",extension='ps', title="F-measure"):
-		import Gnuplot, Gnuplot.funcutils
-		from sys import exit
-		g = Gnuplot.Gnuplot(debug=0, persist=1)
-		if outplot:
-			if   extension == 'ps':  terminal = 'postscript'
-			elif extension == 'png': terminal = 'png'
-			elif extension == 'svg': terminal = 'svg'
-			else: exit("ERR: unknown plot extension")
-			g('set terminal %s' % terminal)
-			g('set output \'fmeas-%s.%s\'' % (outplot,extension))
-		g.xlabel('threshold \\delta')
-		g.ylabel('F-measure (%)')
-		g('set xrange [0:1.2]')
-		g('set yrange [0:100]')
-		g.title(basename(self.datadir))
-		# grid set
-		#g('set grid')
-		#g('set xtics 0,5,%f' % xmax)
-		#g('set ytics %f,5,100' % ymin)
-		#g('set key 27,65')
-		#g('set format \"%g\"')
-		g.plot(*d)
-
-	def plotfmeasvar(self,d,var,plottitle=""):
-		import Gnuplot, Gnuplot.funcutils
-		x,y = [],[]
-		for i in self.vlist:
-			x.append(i[var]) 
-			y.append(i['dist']) 
-		d.append(Gnuplot.Data(x, y, with_='linespoints', 
-			title="%s %s" % (plottitle,i['mode']) ))
-	
-	def plotplotfmeasvar(self,d,var,outplot="",extension='ps', title="F-measure"):
-		import Gnuplot, Gnuplot.funcutils
-		from sys import exit
-		g = Gnuplot.Gnuplot(debug=0, persist=1)
-		if outplot:
-			if   extension == 'ps':  terminal = 'postscript'
-			elif extension == 'png': terminal = 'png'
-			elif extension == 'svg': terminal = 'svg'
-			else: exit("ERR: unknown plot extension")
-			g('set terminal %s' % terminal)
-			g('set output \'fmeas-%s.%s\'' % (outplot,extension))
-		g.xlabel(var)
-		g.ylabel('F-measure (%)')
-		#g('set xrange [0:1.2]')
-		g('set yrange [0:100]')
-		g.title(basename(self.datadir))
-		g.plot(*d)
-
-	def plotdiffs(self,d,plottitle=""):
-		import Gnuplot, Gnuplot.funcutils
-		v = self.v
-		l = v['l']
-		mean   = v['mean']
-		smean  = v['smean']
-		amean  = v['amean']
-		samean = v['samean']
-		val = []
-		per = [0] * 100
-		for i in range(0,100):
-			val.append(i*.001-.05)
-			for j in l: 
-				if abs(j-val[i]) <= 0.001:
-					per[i] += 1
-		total = v['Torig']
-		for i in range(len(per)): per[i] /= total/100.
-
-		d.append(Gnuplot.Data(val, per, with_='fsteps', 
-			title="%s %s" % (plottitle,v['mode']) ))
-		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (mean,smean))
-		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (amean,samean))
-
-
-	def plotplotdiffs(self,d,outplot=0,extension='ps'):
-		import Gnuplot, Gnuplot.funcutils
-		from sys import exit
-		g = Gnuplot.Gnuplot(debug=0, persist=1)
-		if outplot:
-			if   extension == 'ps':  ext, extension = '.ps' , 'postscript'
-			elif extension == 'png': ext, extension = '.png', 'png'
-			elif extension == 'svg': ext, extension = '.svg', 'svg'
-			else: exit("ERR: unknown plot extension")
-			g('set terminal %s' % extension)
-			g('set output \'diffhist-%s%s\'' % (outplot,ext))
-		g('eps(x) = 1./(sigma*(2.*3.14159)**.5) * exp ( - ( x - mean ) ** 2. / ( 2. * sigma ** 2. ))')
-		g.title(basename(self.datadir))
-		g.xlabel('delay to hand-labelled onset (s)')
-		g.ylabel('% number of correct detections / ms ')
-		g('set xrange [-0.05:0.05]')
-		g('set yrange [0:20]')
-		g.plot(*d)
-
-
-	def plothistcat(self,d,plottitle=""):
-		import Gnuplot, Gnuplot.funcutils
-		total = v['Torig']
-		for i in range(len(per)): per[i] /= total/100.
-
-		d.append(Gnuplot.Data(val, per, with_='fsteps', 
-			title="%s %s" % (plottitle,v['mode']) ))
-		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (mean,smean))
-		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (amean,samean))
-
-
-	def plotplothistcat(self,d,outplot=0,extension='ps'):
-		import Gnuplot, Gnuplot.funcutils
-		from sys import exit
-		g = Gnuplot.Gnuplot(debug=0, persist=1)
-		if outplot:
-			if   extension == 'ps':  ext, extension = '.ps' , 'postscript'
-			elif extension == 'png': ext, extension = '.png', 'png'
-			elif extension == 'svg': ext, extension = '.svg', 'svg'
-			else: exit("ERR: unknown plot extension")
-			g('set terminal %s' % extension)
-			g('set output \'diffhist-%s%s\'' % (outplot,ext))
-		g('eps(x) = 1./(sigma*(2.*3.14159)**.5) * exp ( - ( x - mean ) ** 2. / ( 2. * sigma ** 2. ))')
-		g.title(basename(self.datadir))
-		g.xlabel('delay to hand-labelled onset (s)')
-		g.ylabel('% number of correct detections / ms ')
-		g('set xrange [-0.05:0.05]')
-		g('set yrange [0:20]')
-		g.plot(*d)
-
-
--- a/python/aubio/gnuplot.py
+++ /dev/null
@@ -1,222 +1,0 @@
-"""Copyright (C) 2004 Paul Brossier <[email protected]>
-print aubio.__LICENSE__ for the terms of use
-"""
-
-__LICENSE__ = """\
-  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
-
-  This file is part of aubio.
-
-  aubio is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  aubio is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
-"""
-
-
-def audio_to_array(filename):
-	import aubio.aubioclass
-	from numpy import arange
-	hopsize  = 2048
-	filei    = aubio.aubioclass.sndfile(filename)
-	framestep = 1/(filei.samplerate()+0.)
-	channels = filei.channels()
-	myvec    = aubio.aubioclass.fvec(hopsize,channels)
-	data = []
-	readsize = hopsize
-	while (readsize==hopsize):
-		readsize = filei.read(hopsize,myvec)
-		#for i in range(channels):
-		i = 0
-		curpos = 0
-		while (curpos < readsize):
-			data.append(myvec.get(curpos,i))
-			curpos+=1
-	time = arange(len(data))*framestep
-	return time,data
-
-def plot_audio(filenames, g, options):
-	todraw = len(filenames)
-	xorig = 0.
-	xratio = 1./todraw
-	g('set multiplot;')
-	while (len(filenames)):
-		time,data = audio_to_array(filenames.pop(0))
-		if todraw==1:
-			if max(time) < 1.:
-				time = [t*1000. for t in time]
-				g.xlabel('Time (ms)')
-			else:
-				g.xlabel('Time (s)')
-			g.ylabel('Amplitude')
-		curplot = make_audio_plot(time,data)
-		g('set size %f,%f;' % (options.xsize*xratio,options.ysize) )
-		g('set origin %f,0.;' % (xorig) )
-		g('set style data lines; \
-			set yrange [-1.:1.]; \
-			set xrange [0:%f]' % time[-1]) 
-		g.plot(curplot)
-		xorig += options.xsize*xratio 
-	g('unset multiplot;')
-
-def audio_to_spec(filename,minf = 0, maxf = 0, lowthres = -20., 
-		bufsize= 8192, hopsize = 1024):
-	from aubioclass import fvec,cvec,pvoc,sndfile
-	from math import log10
-	filei     = sndfile(filename)
-	srate     = float(filei.samplerate())
-	framestep = hopsize/srate
-	freqstep  = srate/bufsize
-	channels  = filei.channels()
-	myvec = fvec(hopsize,channels)
-	myfft = cvec(bufsize,channels)
-	pv    = pvoc(bufsize,hopsize,channels)
-	data,time,freq = [],[],[]
-
-	if maxf == 0.: maxf = bufsize/2
-	else: maxf = int(maxf/freqstep)
-	if minf: minf = int(minf/freqstep)
-	else: minf = 0 
-
-	for f in range(minf,maxf):
-		freq.append(f*freqstep)
-	readsize = hopsize
-	frameread = 0
-	while (readsize==hopsize):
-		readsize = filei.read(hopsize,myvec)
-		pv.do(myvec,myfft)
-		frame = []
-		i = 0 #for i in range(channels):
-		curpos = minf 
-		while (curpos < maxf):
-			frame.append(max(lowthres,20.*log10(myfft.get(curpos,i)**2+0.00001)))
-			curpos+=1
-		time.append(frameread*framestep)
-		data.append(frame)
-		frameread += 1
-	# crop data if unfinished frames
-	if len(data[-1]) != len(data[0]):
-		data = data[0:-2]
-		time = time[0:-2]
-	# verify size consistency
-	assert len(data) == len(time)
-	assert len(data[0]) == len(freq)
-	return data,time,freq
-
-def plot_spec(filename, g, options):
-	import Gnuplot
-	data,time,freq = audio_to_spec(filename,
-    minf=options.minf,maxf=options.maxf,
-    bufsize=options.bufsize,hopsize=options.hopsize)
-	xorig = 0.
-	if max(time) < 1.:
-		time = [t*1000. for t in time]
-		g.xlabel('Time (ms)')
-	else:
-		g.xlabel('Time (s)')
-	if options.xsize < 0.5 and not options.log and max(time) > 1.:
-		freq = [f/1000. for f in freq]
-		options.minf /= 1000.
-		options.maxf /= 1000.
-		g.ylabel('Frequency (kHz)')
-	else:
-		g.ylabel('Frequency (Hz)')
-	g('set pm3d map')
-	g('set palette rgbformulae -25,-24,-32')
-	g('set cbtics 20')
-	#g('set colorbox horizontal')
-	g('set xrange [0.:%f]' % time[-1]) 
-	if options.log:
-		g('set log y')
-		g('set yrange [%f:%f]' % (max(10,options.minf),options.maxf))
-	else:
-		g('set yrange [%f:%f]' % (options.minf,options.maxf))
-	g.splot(Gnuplot.GridData(data,time,freq, binary=1))
-	#xorig += 1./todraw
-
-def downsample_audio(time,data,maxpoints=10000):
-  """ resample audio data to last only maxpoints """
-  from numpy import array, resize
-  length = len(time)
-  downsample = length/maxpoints
-  if downsample == 0: downsample = 1
-  x = resize(array(time),length)[0:-1:downsample]
-  y = resize(array(data),length)[0:-1:downsample]
-  return x,y
-
-def make_audio_plot(time,data,maxpoints=10000):
-  """ create gnuplot plot from an audio file """
-  import Gnuplot, Gnuplot.funcutils
-  x,y = downsample_audio(time,data,maxpoints=maxpoints)
-  return Gnuplot.Data(x,y,with_='lines')
-
-def make_audio_envelope(time,data,maxpoints=10000):
-  """ create gnuplot plot from an audio file """
-  from numpy import array
-  import Gnuplot, Gnuplot.funcutils
-  bufsize = 500
-  x = [i.mean() for i in resize(array(time), (len(time)/bufsize,bufsize))] 
-  y = [i.mean() for i in resize(array(data), (len(time)/bufsize,bufsize))] 
-  x,y = downsample_audio(x,y,maxpoints=maxpoints)
-  return Gnuplot.Data(x,y,with_='lines')
-
-def gnuplot_addargs(parser):
-  """ add common gnuplot argument to OptParser object """
-  parser.add_option("-x","--xsize",
-          action="store", dest="xsize", default=1., 
-          type='float',help="define xsize for plot")
-  parser.add_option("-y","--ysize",
-          action="store", dest="ysize", default=1., 
-          type='float',help="define ysize for plot")
-  parser.add_option("--debug",
-          action="store_true", dest="debug", default=False, 
-          help="use gnuplot debug mode")
-  parser.add_option("--persist",
-          action="store_false", dest="persist", default=True, 
-          help="do not use gnuplot persistant mode")
-  parser.add_option("--lmargin",
-          action="store", dest="lmargin", default=None, 
-          type='int',help="define left margin for plot")
-  parser.add_option("--rmargin",
-          action="store", dest="rmargin", default=None, 
-          type='int',help="define right margin for plot")
-  parser.add_option("--bmargin",
-          action="store", dest="bmargin", default=None, 
-          type='int',help="define bottom margin for plot")
-  parser.add_option("--tmargin",
-          action="store", dest="tmargin", default=None, 
-          type='int',help="define top margin for plot")
-  parser.add_option("-O","--outplot",
-          action="store", dest="outplot", default=None, 
-          help="save plot to output.{ps,png}")
-
-def gnuplot_create(outplot='',extension='', options=None):
-  import Gnuplot
-  if options:
-    g = Gnuplot.Gnuplot(debug=options.debug, persist=options.persist)
-  else:
-    g = Gnuplot.Gnuplot(persist=1)
-  if not extension or not outplot: return g
-  if   extension == 'ps':  ext, extension = '.ps' , 'postscript'
-  elif extension == 'eps': ext, extension = '.eps' , 'postscript enhanced'
-  elif extension == 'epsc': ext, extension = '.eps' , 'postscript enhanced color'
-  elif extension == 'png': ext, extension = '.png', 'png'
-  elif extension == 'svg': ext, extension = '.svg', 'svg'
-  else: exit("ERR: unknown plot extension")
-  g('set terminal %s' % extension)
-  if options and options.lmargin: g('set lmargin %i' % options.lmargin)
-  if options and options.rmargin: g('set rmargin %i' % options.rmargin)
-  if options and options.bmargin: g('set bmargin %i' % options.bmargin)
-  if options and options.tmargin: g('set tmargin %i' % options.tmargin)
-  if outplot != "stdout":
-    g('set output \'%s%s\'' % (outplot,ext))
-  if options: g('set size %f,%f' % (options.xsize, options.ysize))
-  return g
--- a/python/aubio/median.py
+++ /dev/null
@@ -1,69 +1,0 @@
-"""Copyright (C) 2004 Paul Brossier <[email protected]>
-print aubio.__LICENSE__ for the terms of use
-"""
-
-__LICENSE__ = """\
-  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
-
-  This file is part of aubio.
-
-  aubio is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  aubio is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
-"""            
-
-""" 
-original author Tim Peters
-modified by Paul Brossier <[email protected]>
-inspired from http://www.ics.uci.edu/~eppstein/161/python/peters-selection.py
-"""
-
-def short_find(a, rank):
-    """ find the rank-th value in sorted a """
-    # copy to b before sorting
-    b = a[:]
-    b.sort()
-    return b[rank - 1]
-
-def percental(a, rank):
-    """ Find the rank'th-smallest value in a, in worst-case linear time. """
-    n = len(a)
-    assert 1 <= rank <= n
-    if n <= 7:
-        return short_find(a, rank)
-
-    ## Find median of median-of-7's.
-    ##medians = [short_find(a[i : i+7], 4) for i in xrange(0, n-6, 7)]
-    #median = find(medians, (len(medians) + 1) // 2)
-    
-    # modified to Find median
-    median = short_find([a[0], a[-1], a[n//2]], 2)
-
-    # Partition around the median.
-    # a[:i]   <= median
-    # a[j+1:] >= median
-    i, j = 0, n-1
-    while i <= j:
-        while a[i] < median:
-            i += 1
-        while a[j] > median:
-            j -= 1
-        if i <= j:
-            a[i], a[j] = a[j], a[i]
-            i += 1
-            j -= 1
-
-    if rank <= i:
-        return percental(a[:i], rank)
-    else:
-        return percental(a[i:], rank - i)
-
--- a/python/aubio/onsetcompare.py
+++ /dev/null
@@ -1,143 +1,0 @@
-"""Copyright (C) 2004 Paul Brossier <[email protected]>
-print aubio.__LICENSE__ for the terms of use
-"""
-
-__LICENSE__ = """\
-  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
-
-  This file is part of aubio.
-
-  aubio is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  aubio is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
-"""            
-
-""" this file contains routines to compare two lists of onsets or notes.
-it somewhat implements the Receiver Operating Statistic (ROC).
-see http://en.wikipedia.org/wiki/Receiver_operating_characteristic
-"""
-
-def onset_roc(ltru, lexp, eps):
-    """ compute differences between two lists 
-          orig = hits + missed + merged 
-          expc = hits + bad + doubled
-        returns orig, missed, merged, expc, bad, doubled 
-    """
-    orig, expc = len(ltru), len(lexp)
-    # if lexp is empty
-    if expc == 0 : return orig,orig,0,0,0,0
-    missed, bad, doubled, merged = 0, 0, 0, 0
-    # find missed and doubled ones first
-    for x in ltru:
-        correspond = 0
-        for y in lexp:
-            if abs(x-y) <= eps:    correspond += 1
-        if correspond == 0:        missed += 1
-        elif correspond > 1:       doubled += correspond - 1 
-    # then look for bad and merged ones
-    for y in lexp:
-        correspond = 0
-        for x in ltru:
-            if abs(x-y) <= eps:    correspond += 1
-        if correspond == 0:        bad += 1
-        elif correspond > 1:       merged += correspond - 1
-    # check consistancy of the results
-    assert ( orig - missed - merged == expc - bad - doubled)
-    return orig, missed, merged, expc, bad, doubled 
-
-def onset_diffs(ltru, lexp, eps):
-    """ compute differences between two lists 
-          orig = hits + missed + merged 
-          expc = hits + bad + doubled
-        returns orig, missed, merged, expc, bad, doubled 
-    """
-    orig, expc = len(ltru), len(lexp)
-    # if lexp is empty
-    l = []
-    if expc == 0 : return l 
-    # find missed and doubled ones first
-    for x in ltru:
-        correspond = 0
-        for y in lexp:
-            if abs(x-y) <= eps:    l.append(y-x) 
-    # return list of diffs
-    return l 
-
-def onset_rocloc(ltru, lexp, eps):
-    """ compute differences between two lists 
-          orig = hits + missed + merged 
-          expc = hits + bad + doubled
-        returns orig, missed, merged, expc, bad, doubled 
-    """
-    orig, expc = len(ltru), len(lexp)
-    l = []
-    labs = []
-    mean = 0
-    # if lexp is empty
-    if expc == 0 : return orig,orig,0,0,0,0,l,mean
-    missed, bad, doubled, merged = 0, 0, 0, 0
-    # find missed and doubled ones first
-    for x in ltru:
-        correspond = 0
-        for y in lexp:
-            if abs(x-y) <= eps:    correspond += 1
-        if correspond == 0:        missed += 1
-        elif correspond > 1:       doubled += correspond - 1 
-    # then look for bad and merged ones
-    for y in lexp:
-        correspond = 0
-        for x in ltru:
-            if abs(x-y) <= eps:    
-	    	correspond += 1
-            	l.append(y-x) 
-            	labs.append(abs(y-x))
-        if correspond == 0:        bad += 1
-        elif correspond > 1:       merged += correspond - 1
-    # check consistancy of the results
-    assert ( orig - missed - merged == expc - bad - doubled)
-    return orig, missed, merged, expc, bad, doubled, l, labs
-
-def notes_roc (la, lb, eps):
-    from numpy import transpose, add, resize 
-    """ creates a matrix of size len(la)*len(lb) then look for hit and miss
-    in it within eps tolerance windows """
-    gdn,fpw,fpg,fpa,fdo,fdp = 0,0,0,0,0,0
-    m = len(la)
-    n = len(lb)
-    x =           resize(la[:][0],(n,m))
-    y = transpose(resize(lb[:][0],(m,n)))
-    teps =  (abs(x-y) <= eps[0]) 
-    x =           resize(la[:][1],(n,m))
-    y = transpose(resize(lb[:][1],(m,n)))
-    tpitc = (abs(x-y) <= eps[1]) 
-    res = teps * tpitc
-    res = add.reduce(res,axis=0)
-    for i in range(len(res)) :
-        if res[i] > 1:
-            gdn+=1
-            fdo+=res[i]-1
-        elif res [i] == 1:
-            gdn+=1
-    fpa = n - gdn - fpa
-    return gdn,fpw,fpg,fpa,fdo,fdp
-
-def load_onsets(filename) :
-    """ load onsets targets / candidates files in arrays """
-    l = [];
-    
-    f = open(filename,'ro')
-    while 1:
-        line = f.readline().split()
-        if not line : break
-        l.append(float(line[0]))
-    
-    return l
--- a/python/aubio/plot/keyboard.py
+++ /dev/null
@@ -1,46 +1,0 @@
-
-def draw_keyboard(firstnote = 21, lastnote = 108, y0 = 0, y1 = 1):
-  import Gnuplot
-  octaves = 10
-
-  # build template of white notes
-  scalew  = 12/7.
-  xw_temp = [i*scalew for i in range(0,7)]
-  # build template of black notes
-  scaleb  = 6/7.
-  xb_temp = [i*scaleb for i in [1,3,7,9,11]]
-
-  xb,xw = [],[]
-  for octave in range(octaves-1): 
-    for i in xb_temp:
-      curnote = i+12*octave
-      if  curnote > firstnote-1 and curnote < lastnote+1:
-        xb = xb + [curnote] 
-  for octave in range(octaves-1): 
-    for i in xw_temp:
-      curnote = i+12*octave
-      if  curnote > firstnote-1 and curnote < lastnote+1:
-        xw = xw + [curnote]
-
-  xwdelta = [1/2. * scalew for i in range(len(xw))]
-  yw      = [y0+(y1-y0)*1/2. for i in range(len(xw))]
-  ywdelta = [(y1-y0)*1/2. for i in range(len(xw))]
-
-  xbdelta = [2/3. * scaleb for i in range(len(xb))]
-  yb      = [y0+(y1-y0)*2/3. for i in range(len(xb))]
-  ybdelta = [(y1-y0)*1/3. for i in range(len(xb))]
-
-  whites  = Gnuplot.Data(xw,yw,xwdelta,ywdelta,with_ = 'boxxyerrorbars')
-  blacks  = Gnuplot.Data(xb,yb,xbdelta,ybdelta,with_ = 'boxxyerrorbars fill solid')
-
-  return blacks,whites
-
-if __name__ == '__main__':
-  from aubio.gnuplot import gnuplot_create
-  blacks,whites = draw_keyboard(firstnote = 21, lastnote = 108)
-  g = gnuplot_create('','')
-  #g('set style fill solid .5')
-  #g('set xrange [60-.5:72+.5]')
-  #g('set yrange [-0.1:1.1]')
-
-  g.plot(whites,blacks)
--- a/python/aubio/plot/notes.py
+++ /dev/null
@@ -1,90 +1,0 @@
-__LICENSE__ = """\
-  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
-
-  This file is part of aubio.
-
-  aubio is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  aubio is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
-"""
-
-def plotnote(la,title=None) :
-	if la[0,:].size() == 3:
-	        d = plotnote_withends(la, plot_title=title)
-	else: 
-	    # scale data if in freq (for REF.txt files)
-	    if max(la[:,1] > 128 ):
-	        print "scaling frequency data to midi range"
-	        la[:,1] /= 6.875
-	        la[:,1] = log(la[:,1])/0.6931
-	        la[:,1] *= 12
-	        la[:,1] -= 3
-	    d = plotnote_withoutends(la, plot_title=title)
-	return d
-
-def plotnote_multi(lalist,title=None,fileout=None) :
-	d=list()
-	for i in range(len(lalist)):
-	    d.append(plotnote(lalist[i], title=title))
-	return d
-       
-
-def plotnote_withends(la,plot_title=None) :
-	from numpy import array
-	import Gnuplot, Gnuplot.funcutils
-	d=[]
-	x_widths = array(la[:,1]-la[:,0])/2.
-	d.append(Gnuplot.Data(
-	        la[:,0]+x_widths,               # x centers
-	        la[:,2],                        # y centers
-	        x_widths,                       # x errors
-	        __notesheight*ones(len(la)),    # y errors
-	        title=plot_title,with_=('boxxyerrorbars fs 3')))
-	return d
-
-
-def plotnote_withoutends(la,plot_title=None) :
-        """ bug: fails drawing last note """
-	from numpy import array
-	import Gnuplot, Gnuplot.funcutils
-        d=[]
-        x_widths = array(la[1:,0]-la[:-1,0])/2;
-        d.append(Gnuplot.Data(
-                la[:-1,0]+x_widths,             # x centers
-                la[:-1,1],                      # y centers
-                x_widths,                       # x errors
-                __notesheight*ones(len(la)-1),  # y errors
-                title=plot_title,with_=('boxxyerrorbars fs 3')))
-        return d
-
-def plotnote_do(d,fileout=None):
-    import Gnuplot, Gnuplot.funcutils
-    g = Gnuplot.Gnuplot(debug=1, persist=1)
-    g.gnuplot('set style fill solid border 1; \
-    set size ratio 1/6; \
-    set boxwidth 0.9 relative; \
-    set mxtics 2.5; \
-    set mytics 2.5; \
-    set xtics 5; \
-    set ytics 1; \
-    set grid xtics ytics mxtics mytics')
-
-    g.xlabel('Time (s)')
-    g.ylabel('Midi pitch')
-    # do the plot
-    #g.gnuplot('set multiplot')
-    #for i in d:
-    g.plot(d[0])
-    #g.gnuplot('set nomultiplot') 
-    if fileout != None:
-        g.hardcopy(fileout, enhanced=1, color=0)
-
--- a/python/aubio/task/__init__.py
+++ /dev/null
@@ -1,9 +1,0 @@
-from aubio.aubioclass import *
-from aubio.task.task import task
-from aubio.task.params import taskparams
-from aubio.task.silence import tasksilence
-from aubio.task.onset import taskonset
-from aubio.task.beat import taskbeat
-from aubio.task.cut import taskcut
-from aubio.task.pitch import taskpitch
-from aubio.task.notes import tasknotes
--- a/python/aubio/task/beat.py
+++ /dev/null
@@ -1,262 +1,0 @@
-from aubio.aubioclass import *
-from onset import taskonset
-
-class taskbeat(taskonset):
-	def __init__(self,input,params=None,output=None):
-		""" open the input file and initialize arguments 
-		parameters should be set *before* calling this method.
-		"""
-		taskonset.__init__(self,input,output=None,params=params)
-		self.btwinlen  = 512**2/self.params.hopsize
-		self.btstep    = self.btwinlen/4
-		self.btoutput  = fvec(self.btstep,self.channels)
-		self.dfframe   = fvec(self.btwinlen,self.channels)
-		self.bt	       = beattracking(self.btwinlen,self.channels)
-		self.pos2      = 0
-		self.old       = -1000
-
-	def __call__(self):
-		taskonset.__call__(self)
-		#results = taskonset.__call__(self)
-		# write to current file
-		if self.pos2 == self.btstep - 1 : 
-			self.bt.do(self.dfframe,self.btoutput)
-			for i in range (self.btwinlen - self.btstep):
-				self.dfframe.set(self.dfframe.get(i+self.btstep,0),i,0) 
-			for i in range(self.btwinlen - self.btstep, self.btwinlen): 
-				self.dfframe.set(0,i,0)
-			self.pos2 = -1;
-		self.pos2 += 1
-		val = self.opick.pp.getval()
-		#if not results: val = 0
-		#else: val = results[1] 
-		self.dfframe.set(val,self.btwinlen - self.btstep + self.pos2,0)
-		i=0
-		for i in range(1,int( self.btoutput.get(0,0) ) ):
-			if self.pos2 == self.btoutput.get(i,0) and \
-				aubio_silence_detection(self.myvec(),
-					self.params.silence)!=1: 
-				now = self.frameread-0
-				period = (60 * self.params.samplerate) / ((now - self.old) * self.params.hopsize)
-				self.old = now
-				return now,period
-
-	def eval(self,results,tol=0.20,tolcontext=0.25):
-		obeats = self.gettruth()
-		etime = [result[0] for result in results]
-		otime = [obeat[0] for obeat in obeats]
-		CML_tot, CML_max, CML_start, CML_end = 0,0,0,0
-		AML_tot, AML_max, AML_start, AML_end = 0,0,0,0
-		AMLd_tot, AMLd_max, AMLd_start, AMLd_end = 0,0,0,0
-		AMLh_tot, AMLh_max, AMLh_start, AMLh_end = 0,0,0,0
-		AMLo_tot, AMLo_max, AMLo_start, AMLo_end = 0,0,0,0
-		# results iteration
-		j = 1
-		# for each annotation
-		for i in range(2,len(otime)-2):
-			if j+1 >= len(etime): break
-			count = 0
-			# look for next matching beat
-			while otime[i] > etime[j] - (otime[i] - otime[i+1])*tol:
-				if count > 0: 
-					#print "spurious etime"
-					if CML_end - CML_start > CML_max:
-						CML_max = CML_end - CML_start
-					CML_start, CML_end = j, j
-					if AMLh_end - AMLh_start > AMLh_max:
-						AMLh_max = AMLh_end - AMLh_start
-					AMLh_start, AMLh_end = j, j
-					if AMLd_end - AMLd_start > AMLd_max:
-						AMLd_max = AMLd_end - AMLd_start
-					AMLd_start, AMLd_end = j, j
-					if AMLo_end - AMLo_start > AMLo_max:
-						AMLo_max = AMLo_end - AMLo_start
-					AMLo_start, AMLo_end = j, j
-				j += 1
-				count += 1
-			if j+1 >= len(etime): break
-			#print otime[i-1],etime[j-1]," ",otime[i],etime[j]," ",otime[i+1],etime[j+1] 
-			prevtempo = (otime[i] - otime[i-1])
-			nexttempo = (otime[i+1] - otime[i])
-
-			current0  = (etime[j] > otime[i] - prevtempo*tol)
-			current1  = (etime[j] < otime[i] + prevtempo*tol)
-
-			# check correct tempo 
-			prev0 = (etime[j-1] > otime[i-1] - prevtempo*tolcontext)
-			prev1 = (etime[j-1] < otime[i-1] + prevtempo*tolcontext)
-			next0 = (etime[j+1] > otime[i+1] - nexttempo*tolcontext)
-			next1 = (etime[j+1] < otime[i+1] + nexttempo*tolcontext)
-
-			# check for off beat
-			prevoffb0 = (etime[j-1] > otime[i-1] - prevtempo/2 - prevtempo*tolcontext)
-			prevoffb1 = (etime[j-1] < otime[i-1] - prevtempo/2 + prevtempo*tolcontext)
-			nextoffb0 = (etime[j+1] > otime[i+1] - nexttempo/2 - nexttempo*tolcontext)
-			nextoffb1 = (etime[j+1] < otime[i+1] - nexttempo/2 + nexttempo*tolcontext)
-
-			# check half tempo 
-			prevhalf0 = (etime[j-1] > otime[i-1] + prevtempo - prevtempo/2*tolcontext)
-			prevhalf1 = (etime[j-1] < otime[i-1] + prevtempo + prevtempo/2*tolcontext)
-			nexthalf0 = (etime[j+1] > otime[i+1] - nexttempo - nexttempo/2*tolcontext)
-			nexthalf1 = (etime[j+1] < otime[i+1] - nexttempo + nexttempo/2*tolcontext)
-
-			# check double tempo
-			prevdoub0 = (etime[j-1] > otime[i-1] - prevtempo - prevtempo*2*tolcontext)
-			prevdoub1 = (etime[j-1] < otime[i-1] - prevtempo + prevtempo*2*tolcontext)
-			nextdoub0 = (etime[j+1] > otime[i+1] + nexttempo - nexttempo*2*tolcontext)
-			nextdoub1 = (etime[j+1] < otime[i+1] + nexttempo + nexttempo*2*tolcontext)
-
-			if current0 and current1 and prev0 and prev1 and next0 and next1: 
-				#print "YES!"
-				CML_end = j	
-				CML_tot += 1
-			else:
-				if CML_end - CML_start > CML_max:
-					CML_max = CML_end - CML_start
-				CML_start, CML_end = j, j
-			if current0 and current1 and prevhalf0 and prevhalf1 and nexthalf0 and nexthalf1: 
-				AMLh_end = j
-				AMLh_tot += 1
-			else:
-				if AMLh_end - AMLh_start > AMLh_max:
-					AMLh_max = AMLh_end - AMLh_start
-				AMLh_start, AMLh_end = j, j
-			if current0 and current1 and prevdoub0 and prevdoub1 and nextdoub0 and nextdoub1: 
-				AMLd_end = j
-				AMLd_tot += 1
-			else:
-				if AMLd_end - AMLd_start > AMLd_max:
-					AMLd_max = AMLd_end - AMLd_start
-				AMLd_start, AMLd_end = j, j
-			if current0 and current1 and prevoffb0 and prevoffb1 and nextoffb0 and nextoffb1: 
-				AMLo_end = j
-				AMLo_tot += 1
-			else:
-				if AMLo_end - AMLo_start > AMLo_max:
-					AMLo_max = AMLo_end - AMLo_start
-				AMLo_start, AMLo_end = j, j
-			# look for next matching beat
-			count = 0 
-			while otime[i] > etime[j] - (otime[i] - otime[i+1])*tolcontext:
-				j += 1
-				if count > 0: 
-					#print "spurious etime"
-					start = j
-				count += 1
-		total = float(len(otime))
-		CML_tot  /= total 
-		AMLh_tot /= total 
-		AMLd_tot /= total 
-		AMLo_tot /= total 
-		CML_cont  = CML_max/total
-		AMLh_cont = AMLh_max/total
-		AMLd_cont = AMLd_max/total
-		AMLo_cont = AMLo_max/total
-		return CML_cont, CML_tot, AMLh_cont, AMLh_tot, AMLd_cont, AMLd_tot, AMLo_cont, AMLo_tot
-
-#		for i in allfreq:
-#			freq.append(float(i) / 2. / N  * samplerate )
-#			while freq[i]>freqs[j]:
-#				j += 1
-#			a0 = weight[j-1]
-#			a1 = weight[j]
-#			f0 = freqs[j-1]
-#			f1 = freqs[j]
-#			if f0!=0:
-#				iweight.append((a1-a0)/(f1-f0)*freq[i] + (a0 - (a1 - a0)/(f1/f0 -1.)))
-#			else:
-#				iweight.append((a1-a0)/(f1-f0)*freq[i] + a0)
-#			while freq[i]>freqs[j]:
-#				j += 1
-			
-	def eval2(self,results,tol=0.2):
-		truth = self.gettruth()
-		obeats = [i[0] for i in truth] 
-		ebeats = [i[0]*self.params.step for i in results] 
-		NP = max(len(obeats), len(ebeats))
-		N  = int(round(max(max(obeats), max(ebeats))*100.)+100)
-		W  = int(round(tol*100.*60./median([i[1] for i in truth], len(truth)/2)))
-		ofunc = [0 for i in range(N+W)]
-		efunc = [0 for i in range(N+W)]
-		for i in obeats: ofunc[int(round(i*100.)+W)] = 1
-		for i in ebeats: efunc[int(round(i*100.)+W)] = 1
-		assert len(obeats) == sum(ofunc)
-		autocor = 0; m =0
-		for m in range (-W, W):
-			for i in range(W,N):
-				autocor += ofunc[i] * efunc[i-m] 
-		autocor /= float(NP)
-		return autocor
-	
-	def evaluation(self,results,tol=0.2,start=5.):
-
-		""" beat tracking evaluation function
-
-		computes P-score of experimental results (ebeats)
-		        against ground truth annotations (obeats) """
-
-		from aubio.median import short_find as median
-		truth = self.gettruth()
-		ebeats = [i[0]*self.params.step for i in results] 
-		obeats = [i[0] for i in truth] 
-
-		# trim anything found before start
-		while obeats[0] < start: obeats.pop(0)
-		while ebeats[0] < start: ebeats.pop(0)
-		# maximum number of beats found 
-		NP = max(len(obeats), len(ebeats))
-		# length of ofunc and efunc vector 
-		N  = int(round(max(max(obeats), max(ebeats))*100.)+100)
-		# compute W median of ground truth tempi 
-		tempi = []
-		for i in range(1,len(obeats)): tempi.append(obeats[i]-obeats[i-1])
-		W  = int(round(tol*100.*median(tempi,len(tempi)/2)))
-		# build ofunc and efunc functions, starting with W zeros  
-		ofunc = [0 for i in range(N+W)]
-		efunc = [0 for i in range(N+W)]
-		for i in obeats: ofunc[int(round(i*100.)+W)] = 1
-		for i in ebeats: efunc[int(round(i*100.)+W)] = 1
-		# optional: make sure we didn't miss any beats  
-		assert len(obeats) == sum(ofunc)
-		assert len(ebeats) == sum(efunc)
-		# compute auto correlation 
-		autocor = 0; m =0
-		for m in range (-W, W):
-		  for i in range(W,N):
-		    autocor += ofunc[i] * efunc[i-m] 
-		autocor /= float(NP)
-		return autocor
-
-	def gettruth(self):
-		import os.path
-		from aubio.txtfile import read_datafile
-		datafile = self.input.replace('.wav','.txt')
-		if not os.path.isfile(datafile):
-			print "no ground truth "
-			return False,False
-		else:
-			values = read_datafile(datafile,depth=0)
-			old = -1000
-			for i in range(len(values)):
-				now = values[i]
-				period = 60 / (now - old)
-				old = now
-				values[i] = [now,period]
-		return values
-	
-
-	def plot(self,oplots,results):
-		import Gnuplot
-		oplots.append(Gnuplot.Data(results,with_='linespoints',title="auto"))
-
-	def plotplot(self,wplot,oplots,outplot=None,extension=None,xsize=1.,ysize=1.,spectro=False):
-		import Gnuplot
-		from aubio.gnuplot import gnuplot_create, audio_to_array, make_audio_plot
-		import re
-		# audio data
-		#time,data = audio_to_array(self.input)
-		#f = make_audio_plot(time,data)
-
-		g = gnuplot_create(outplot=outplot, extension=extension)
-		oplots = [Gnuplot.Data(self.gettruth(),with_='linespoints',title="orig")] + oplots
-		g.plot(*oplots)
--- a/python/aubio/task/cut.py
+++ /dev/null
@@ -1,42 +1,0 @@
-from task import task
-from aubio.aubioclass import *
-
-class taskcut(task):
-	def __init__(self,input,slicetimes,params=None,output=None):
-		""" open the input file and initialize arguments 
-		parameters should be set *before* calling this method.
-		"""
-		from os.path import basename,splitext
-		task.__init__(self,input,output=None,params=params)
-		self.soundoutbase, self.soundoutext = splitext(basename(self.input))
-		self.newname   = "%s%s%09.5f%s%s" % (self.soundoutbase,".",
-					self.frameread*self.params.step,".",self.soundoutext)
-		self.fileo	= sndfile(self.newname,model=self.filei)
-		self.myvec	= fvec(self.params.hopsize,self.channels)
-		self.mycopy	= fvec(self.params.hopsize,self.channels)
-		self.slicetimes = slicetimes 
-
-	def __call__(self):
-		task.__call__(self)
-		# write to current file
-		if len(self.slicetimes) and self.frameread >= self.slicetimes[0][0]:
-			self.slicetimes.pop(0)
-			# write up to 1st zero crossing
-			zerocross = 0
-			while ( abs( self.myvec.get(zerocross,0) ) > self.params.zerothres ):
-				zerocross += 1
-			writesize = self.fileo.write(zerocross,self.myvec)
-			fromcross = 0
-			while (zerocross < self.readsize):
-				for i in range(self.channels):
-					self.mycopy.set(self.myvec.get(zerocross,i),fromcross,i)
-					fromcross += 1
-					zerocross += 1
-			del self.fileo
-			self.fileo = sndfile("%s%s%09.5f%s%s" % (self.soundoutbase,".",
-				self.frameread*self.params.step,".",self.soundoutext),model=self.filei)
-			writesize = self.fileo.write(fromcross,self.mycopy)
-		else:
-			writesize = self.fileo.write(self.readsize,self.myvec)
-
-
--- a/python/aubio/task/notes.py
+++ /dev/null
@@ -1,159 +1,0 @@
-
-from aubio.task import task
-from aubio.aubioclass import *
-
-class tasknotes(task):
-	def __init__(self,input,output=None,params=None):
-		task.__init__(self,input,params=params)
-		self.opick = onsetpick(self.params.bufsize,
-			self.params.hopsize,
-			self.channels,
-			self.myvec,
-			self.params.threshold,
-			mode=self.params.onsetmode,
-			dcthreshold=self.params.dcthreshold,
-			derivate=self.params.derivate)
-		self.pitchdet  = pitch(mode=self.params.pitchmode,
-			bufsize=self.params.pbufsize,
-			hopsize=self.params.phopsize,
-			channels=self.channels,
-			samplerate=self.srate,
-			omode=self.params.omode)
-		self.olist = [] 
-		self.ofunc = []
-		self.maxofunc = 0
-		self.last = -1000
-		self.oldifreq = 0
-		if self.params.localmin:
-			self.ovalist   = [0., 0., 0., 0., 0.]
-
-	def __call__(self):
-		from aubio.median import short_find
-		task.__call__(self)
-		isonset,val = self.opick.do(self.myvec)
-		if (aubio_silence_detection(self.myvec(),self.params.silence)):
-			isonset=0
-			freq = -1.
-		else:
-			freq = self.pitchdet(self.myvec)
-		minpitch = self.params.pitchmin
-		maxpitch = self.params.pitchmax
-		if maxpitch and freq > maxpitch : 
-			freq = -1.
-		elif minpitch and freq < minpitch :
-			freq = -1.
-		freq = aubio_freqtomidi(freq)
-		if self.params.pitchsmooth:
-			self.shortlist.append(freq)
-			self.shortlist.pop(0)
-			smoothfreq = short_find(self.shortlist,
-				len(self.shortlist)/2)
-			freq = smoothfreq
-		now = self.frameread
-		ifreq = int(round(freq))
-		if self.oldifreq == ifreq:
-			self.oldifreq = ifreq
-		else:
-			self.oldifreq = ifreq
-			ifreq = 0 
-		# take back delay
-		if self.params.delay != 0.: now -= self.params.delay
-		if now < 0 :
-			now = 0
-		if (isonset == 1):
-			if self.params.mintol:
-				# prune doubled 
-				if (now - self.last) > self.params.mintol:
-					self.last = now
-					return now, 1, freq, ifreq
-				else:
-					return now, 0, freq, ifreq
-			else:
-				return now, 1, freq, ifreq 
-		else:
-			return now, 0, freq, ifreq
-
-
-	def fprint(self,foo):
-		print self.params.step*foo[0], foo[1], foo[2], foo[3]
-
-	def compute_all(self):
-		""" Compute data """
-    		now, onset, freq, ifreq = [], [], [], []
-		while(self.readsize==self.params.hopsize):
-			n, o, f, i = self()
-			now.append(n*self.params.step)
-			onset.append(o)
-			freq.append(f)
-			ifreq.append(i)
-			if self.params.verbose:
-				self.fprint((n,o,f,i))
-    		return now, onset, freq, ifreq 
-
-	def plot(self,now,onset,freq,ifreq,oplots):
-		import Gnuplot
-
-		oplots.append(Gnuplot.Data(now,freq,with_='lines',
-			title=self.params.pitchmode))
-		oplots.append(Gnuplot.Data(now,ifreq,with_='lines',
-			title=self.params.pitchmode))
-
-		temponsets = []
-		for i in onset:
-			temponsets.append(i*1000)
-		oplots.append(Gnuplot.Data(now,temponsets,with_='impulses',
-			title=self.params.pitchmode))
-
-	def plotplot(self,wplot,oplots,outplot=None,multiplot = 0):
-		from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot
-		import re
-		import Gnuplot
-		# audio data
-		time,data = audio_to_array(self.input)
-		f = make_audio_plot(time,data)
-
-		# check if ground truth exists
-		#timet,pitcht = self.gettruth()
-		#if timet and pitcht:
-		#	oplots = [Gnuplot.Data(timet,pitcht,with_='lines',
-		#		title='ground truth')] + oplots
-
-		t = Gnuplot.Data(0,0,with_='impulses') 
-
-		g = gnuplot_init(outplot)
-		g('set title \'%s\'' % (re.sub('.*/','',self.input)))
-		g('set multiplot')
-		# hack to align left axis
-		g('set lmargin 15')
-		# plot waveform and onsets
-		g('set size 1,0.3')
-		g('set origin 0,0.7')
-		g('set xrange [0:%f]' % max(time)) 
-		g('set yrange [-1:1]') 
-		g.ylabel('amplitude')
-		g.plot(f)
-		g('unset title')
-		# plot onset detection function
-
-
-		g('set size 1,0.7')
-		g('set origin 0,0')
-		g('set xrange [0:%f]' % max(time))
-		g('set yrange [20:100]')
-		g('set key right top')
-		g('set noclip one') 
-		#g('set format x ""')
-		#g('set log y')
-		#g.xlabel('time (s)')
-		g.ylabel('f0 (Hz)')
-		if multiplot:
-			for i in range(len(oplots)):
-				# plot onset detection functions
-				g('set size 1,%f' % (0.7/(len(oplots))))
-				g('set origin 0,%f' % (float(i)*0.7/(len(oplots))))
-				g('set xrange [0:%f]' % max(time))
-				g.plot(oplots[i])
-		else:
-			g.plot(*oplots)
-		#g('unset multiplot')
-
--- a/python/aubio/task/onset.py
+++ /dev/null
@@ -1,220 +1,0 @@
-from aubio.task.task import task
-from aubio.aubioclass import *
-
-class taskonset(task):
-	def __init__(self,input,output=None,params=None):
-		""" open the input file and initialize arguments 
-		parameters should be set *before* calling this method.
-		"""
-		task.__init__(self,input,params=params)
-		self.opick = onsetpick(self.params.bufsize,
-			self.params.hopsize,
-			self.myvec,
-			self.params.threshold,
-			mode=self.params.onsetmode,
-			dcthreshold=self.params.dcthreshold,
-			derivate=self.params.derivate)
-		self.olist = [] 
-		self.ofunc = []
-		self.maxofunc = 0
-		self.last = 0
-		if self.params.localmin:
-			self.ovalist   = [0., 0., 0., 0., 0.]
-
-	def __call__(self):
-		task.__call__(self)
-		isonset,val = self.opick.do(self.myvec)
-		if (aubio_silence_detection(self.myvec(),self.params.silence)):
-			isonset=0
-		if self.params.storefunc:
-			self.ofunc.append(val)
-		if self.params.localmin:
-			if val > 0: self.ovalist.append(val)
-			else: self.ovalist.append(0)
-			self.ovalist.pop(0)
-		if (isonset > 0.):
-			if self.params.localmin:
-				# find local minima before peak 
-				i=len(self.ovalist)-1
-				while self.ovalist[i-1] < self.ovalist[i] and i > 0:
-					i -= 1
-				now = (self.frameread+1-i)
-			else:
-				now = self.frameread
-			# take back delay
-			if self.params.delay != 0.: now -= self.params.delay
-			if now < 0 :
-				now = 0
-			if self.params.mintol:
-				# prune doubled 
-				if (now - self.last) > self.params.mintol:
-					self.last = now
-					return now, val
-			else:
-				return now, val 
-
-
-	def fprint(self,foo):
-		print self.params.step*foo[0]
-
-	def eval(self,inputdata,ftru,mode='roc',vmode=''):
-		from aubio.txtfile import read_datafile 
-		from aubio.onsetcompare import onset_roc, onset_diffs, onset_rocloc
-		ltru = read_datafile(ftru,depth=0)
-		lres = []
-		for i in range(len(inputdata)): lres.append(inputdata[i][0]*self.params.step)
-		if vmode=='verbose':
-			print "Running with mode %s" % self.params.onsetmode, 
-			print " and threshold %f" % self.params.threshold, 
-			print " on file", self.input
-		#print ltru; print lres
-		if mode == 'local':
-			l = onset_diffs(ltru,lres,self.params.tol)
-			mean = 0
-			for i in l: mean += i
-			if len(l): mean = "%.3f" % (mean/len(l))
-			else: mean = "?0"
-			return l, mean
-		elif mode == 'roc':
-			self.orig, self.missed, self.merged, \
-				self.expc, self.bad, self.doubled = \
-				onset_roc(ltru,lres,self.params.tol)
-		elif mode == 'rocloc':
-			self.v = {}
-			self.v['orig'], self.v['missed'], self.v['Tm'], \
-				self.v['expc'], self.v['bad'], self.v['Td'], \
-				self.v['l'], self.v['labs'] = \
-				onset_rocloc(ltru,lres,self.params.tol)
-
-	def plot(self,onsets,ofunc,wplot,oplots,nplot=False):
-		import Gnuplot, Gnuplot.funcutils
-		import aubio.txtfile
-		import os.path
-		from numpy import arange, array, ones
-		from aubio.onsetcompare import onset_roc
-
-		x1,y1,y1p = [],[],[]
-		oplot = []
-		if self.params.onsetmode in ('mkl','kl'): ofunc[0:10] = [0] * 10
-
-		self.lenofunc = len(ofunc) 
-		self.maxofunc = max(ofunc)
-		# onset detection function 
-		downtime = arange(len(ofunc))*self.params.step
-		oplot.append(Gnuplot.Data(downtime,ofunc,with_='lines',title=self.params.onsetmode))
-
-		# detected onsets
-		if not nplot:
-			for i in onsets:
-				x1.append(i[0]*self.params.step)
-				y1.append(self.maxofunc)
-				y1p.append(-self.maxofunc)
-			#x1 = array(onsets)*self.params.step
-			#y1 = self.maxofunc*ones(len(onsets))
-			if x1:
-				oplot.append(Gnuplot.Data(x1,y1,with_='impulses'))
-				wplot.append(Gnuplot.Data(x1,y1p,with_='impulses'))
-
-		oplots.append((oplot,self.params.onsetmode,self.maxofunc))
-
-		# check if ground truth datafile exists
-		datafile = self.input.replace('.wav','.txt')
-		if datafile == self.input: datafile = ""
-		if not os.path.isfile(datafile):
-			self.title = "" #"(no ground truth)"
-		else:
-			t_onsets = aubio.txtfile.read_datafile(datafile)
-			x2 = array(t_onsets).resize(len(t_onsets))
-			y2 = self.maxofunc*ones(len(t_onsets))
-			wplot.append(Gnuplot.Data(x2,y2,with_='impulses'))
-			
-			tol = 0.050 
-
-			orig, missed, merged, expc, bad, doubled = \
-				onset_roc(x2,x1,tol)
-			self.title = "GD %2.3f%% FP %2.3f%%" % \
-				((100*float(orig-missed-merged)/(orig)),
-				 (100*float(bad+doubled)/(orig)))
-
-
-	def plotplot(self,wplot,oplots,outplot=None,extension=None,xsize=1.,ysize=1.,spectro=False):
-		from aubio.gnuplot import gnuplot_create, audio_to_array, make_audio_plot, audio_to_spec
-		import re
-		# prepare the plot
-		g = gnuplot_create(outplot=outplot, extension=extension)
-		g('set title \'%s\'' % (re.sub('.*/','',self.input)))
-		if spectro:
-			g('set size %f,%f' % (xsize,1.3*ysize) )
-		else:
-			g('set size %f,%f' % (xsize,ysize) )
-		g('set multiplot')
-
-		# hack to align left axis
-		g('set lmargin 3')
-		g('set rmargin 6')
-
-		if spectro:
-			import Gnuplot
-			minf = 50
-			maxf = 500 
-			data,time,freq = audio_to_spec(self.input,minf=minf,maxf=maxf)
-			g('set size %f,%f' % (1.24*xsize , 0.34*ysize) )
-			g('set origin %f,%f' % (-0.12,0.65*ysize))
-			g('set xrange [0.:%f]' % time[-1]) 
-			g('set yrange [%f:%f]' % (minf,maxf))
-			g('set pm3d map')
-			g('unset colorbox')
-			g('set lmargin 0')
-			g('set rmargin 0')
-			g('set tmargin 0')
-			g('set palette rgbformulae -25,-24,-32')
-			g.xlabel('time (s)',offset=(0,1.))
-			g.ylabel('freq (Hz)')
-			g('set origin 0,%f' % (1.0*ysize) ) 
-			g('set format x "%1.1f"')
-			#if log:
-			#	g('set yrange [%f:%f]' % (max(10,minf),maxf))
-			#	g('set log y')
-			g.splot(Gnuplot.GridData(data,time,freq, binary=1, title=''))
-		else:
-			# plot waveform and onsets
-			time,data = audio_to_array(self.input)
-			wplot = [make_audio_plot(time,data)] + wplot
-			g('set origin 0,%f' % (0.7*ysize) )
-			g('set size %f,%f' % (xsize,0.3*ysize))
-			g('set format y "%1f"')
-			g('set xrange [0:%f]' % max(time)) 
-			g('set yrange [-1:1]') 
-			g('set noytics')
-			g('set y2tics -1,1')
-			g.xlabel('time (s)',offset=(0,0.7))
-			g.ylabel('amplitude')
-			g.plot(*wplot)
-
-		# default settings for next plots
-		g('unset title')
-		g('set format x ""')
-		g('set format y "%3e"')
-		g('set tmargin 0')
-		g.xlabel('')
-
-		N = len(oplots)
-		y = 0.7*ysize # the vertical proportion of the plot taken by onset functions
-		delta = 0.035 # the constant part of y taken by last plot label and data
-		for i in range(N):
-			# plot onset detection functions
-			g('set size %f,%f' % ( xsize, (y-delta)/N))
-			g('set origin 0,%f' % ((N-i-1)*(y-delta)/N + delta ))
-			g('set nokey')
-			g('set xrange [0:%f]' % (self.lenofunc*self.params.step))
-			g('set yrange [0:%f]' % (1.1*oplots[i][2]))
-			g('set y2tics ("0" 0, "%d" %d)' % (round(oplots[i][2]),round(oplots[i][2])))
-			g.ylabel(oplots[i][1])
-			if i == N-1:
-				g('set size %f,%f' % ( xsize, (y-delta)/N + delta ) )
-				g('set origin 0,0')
-				g.xlabel('time (s)', offset=(0,0.7))
-				g('set format x')
-			g.plot(*oplots[i][0])
-
-		g('unset multiplot')
--- a/python/aubio/task/params.py
+++ /dev/null
@@ -1,33 +1,0 @@
-
-class taskparams(object):
-	""" default parameters for task classes """
-	def __init__(self,input=None,output=None):
-		self.silence = -90
-		self.derivate = False
-		self.localmin = False
-		self.delay = 4.
-		self.storefunc = False
-		self.bufsize = 512
-		self.hopsize = 256
-		self.pbufsize = 2048
-		self.phopsize =  512
-		self.samplerate = 44100
-		self.tol = 0.05
-		self.mintol = 0.0
-		self.step = float(self.hopsize)/float(self.samplerate)
-		self.threshold = 0.1
-		self.onsetmode = 'dual'
-		self.pitchmode = 'yin'
-		# best threshold for yin monophonic Mirex04 (depth of f0) 
-		self.yinthresh = 0.15 
-		# best thresh for yinfft monophonic Mirex04 (tradeoff sil/gd)
-		# also best param for yinfft polyphonic Mirex04
-		self.yinfftthresh = 0.85 
-		self.pitchsmooth = 0
-		self.pitchmin=20.
-		self.pitchmax=20000.
-		self.pitchdelay = -0.5
-		self.dcthreshold = -1.
-		self.omode = "freq"
-		self.verbose   = False
-
--- a/python/aubio/task/pitch.py
+++ /dev/null
@@ -1,234 +1,0 @@
-from aubio.task.task import task
-from aubio.task.silence import tasksilence
-from aubio.aubioclass import *
-
-class taskpitch(task):
-	def __init__(self,input,params=None):
-		task.__init__(self,input,params=params)
-		self.shortlist = [0. for i in range(self.params.pitchsmooth)]
-		if self.params.pitchmode == 'yin':
-			tolerance = self.params.yinthresh
-		elif self.params.pitchmode == 'yinfft':
-			tolerance = self.params.yinfftthresh
-		else:
-			tolerance = 0.
-		self.pitchdet	= pitch(mode=self.params.pitchmode,
-			bufsize=self.params.bufsize,
-			hopsize=self.params.hopsize,
-			samplerate=self.srate,
-			omode=self.params.omode,
-			tolerance = tolerance)
-
-	def __call__(self):
-		from aubio.median import short_find
-		task.__call__(self)
-		if (aubio_silence_detection(self.myvec(),self.params.silence)==1):
-			freq = -1.
-		else:
-			freq = self.pitchdet(self.myvec)
-		minpitch = self.params.pitchmin
-		maxpitch = self.params.pitchmax
-		if maxpitch and freq > maxpitch : 
-			freq = -1.
-		elif minpitch and freq < minpitch :
-			freq = -1.
-		if self.params.pitchsmooth:
-			self.shortlist.append(freq)
-			self.shortlist.pop(0)
-			smoothfreq = short_find(self.shortlist,
-				len(self.shortlist)/2)
-			return smoothfreq
-		else:
-			return freq
-
-	def compute_all(self):
-		""" Compute data """
-    		mylist    = []
-		while(self.readsize==self.params.hopsize):
-			freq = self()
-			mylist.append(freq)
-			if self.params.verbose:
-				self.fprint("%s\t%s" % (self.frameread*self.params.step,freq))
-    		return mylist
-
-	def gettruth(self):
-		""" extract ground truth array in frequency """
-		import os.path
-		""" from wavfile.txt """
-		datafile = self.input.replace('.wav','.txt')
-		if datafile == self.input: datafile = ""
-		""" from file.<midinote>.wav """
-		# FIXME very weak check
-		floatpit = self.input.split('.')[-2]
-		if not os.path.isfile(datafile) and len(self.input.split('.')) < 3:
-			print "no ground truth "
-			return False,False
-		elif floatpit:
-			try:
-				self.truth = float(floatpit)
-				#print "ground truth found in filename:", self.truth
-				tasksil = tasksilence(self.input,params=self.params)
-				time,pitch =[],[]
-				while(tasksil.readsize==tasksil.params.hopsize):
-					tasksil()
-					time.append(tasksil.params.step*(tasksil.frameread))
-					if not tasksil.issilence:
-						pitch.append(self.truth)
-					else:
-						pitch.append(-1.)
-				return time,pitch
-			except ValueError:
-				# FIXME very weak check
-				if not os.path.isfile(datafile):
-					print "no ground truth found"
-					return 0,0
-				else:
-					from aubio.txtfile import read_datafile
-					values = read_datafile(datafile)
-					time, pitch = [], []
-					for i in range(len(values)):
-						time.append(values[i][0])
-						if values[i][1] == 0.0:
-							pitch.append(-1.)
-						else:
-							pitch.append(aubio_freqtomidi(values[i][1]))
-					return time,pitch
-
-	def oldeval(self,results):
-		def mmean(l):
-			return sum(l)/max(float(len(l)),1)
-
-		from aubio.median import percental 
-		timet,pitcht = self.gettruth()
-		res = []
-		for i in results:
-			#print i,self.truth
-			if i <= 0: pass
-			else: res.append(self.truth-i)
-		if not res or len(res) < 3: 
-			avg = self.truth; med = self.truth 
-		else:
-			avg = mmean(res) 
-			med = percental(res,len(res)/2) 
-		return self.truth, self.truth-med, self.truth-avg
-
-	def eval(self,pitch,tol=0.5):
-		timet,pitcht = self.gettruth()
-		pitch = [aubio_freqtomidi(i) for i in pitch]
-		for i in range(len(pitch)):
-			if pitch[i] == "nan" or pitch[i] == -1:
-				pitch[i] = -1
-		time = [ (i+self.params.pitchdelay)*self.params.step for i in range(len(pitch)) ]
-		#print len(timet),len(pitcht)
-		#print len(time),len(pitch)
-		if len(timet) != len(time):
-			time = time[1:len(timet)+1]
-			pitch = pitch[1:len(pitcht)+1]
-			#pitcht = [aubio_freqtomidi(i) for i in pitcht]
-			for i in range(len(pitcht)):
-				if pitcht[i] == "nan" or pitcht[i] == "-inf" or pitcht[i] == -1:
-					pitcht[i] = -1
-		assert len(timet) == len(time)
-		assert len(pitcht) == len(pitch)
-		osil, esil, opit, epit, echr = 0, 0, 0, 0, 0
-		for i in range(len(pitcht)):
-			if pitcht[i] == -1: # currently silent
-				osil += 1 # count a silence
-				if pitch[i] <= 0. or pitch[i] == "nan": 
-					esil += 1 # found a silence
-			else:
-				opit +=1
-				if abs(pitcht[i] - pitch[i]) < tol:
-					epit += 1
-					echr += 1
-				elif abs(pitcht[i] - pitch[i]) % 12. < tol:
-					echr += 1
-				#else:
-				#	print timet[i], pitcht[i], time[i], pitch[i]
-		#print "origsilence", "foundsilence", "origpitch", "foundpitch", "orig pitchroma", "found pitchchroma"
-		#print 100.*esil/float(osil), 100.*epit/float(opit), 100.*echr/float(opit)
-		return osil, esil, opit, epit, echr
-
-	def plot(self,pitch,wplot,oplots,titles,outplot=None):
-		import Gnuplot
-
-		time = [ (i+self.params.pitchdelay)*self.params.step for i in range(len(pitch)) ]
-		pitch = [aubio_freqtomidi(i) for i in pitch]
-		oplots.append(Gnuplot.Data(time,pitch,with_='lines',
-			title=self.params.pitchmode))
-		titles.append(self.params.pitchmode)
-
-			
-	def plotplot(self,wplot,oplots,titles,outplot=None,extension=None,xsize=1.,ysize=1.,multiplot = 1, midi = 1, truth = 1):
-		from aubio.gnuplot import gnuplot_create , audio_to_array, make_audio_plot
-		import re
-		import Gnuplot
-
-		# check if ground truth exists
-		if truth:
-			timet,pitcht = self.gettruth()
-			if timet and pitcht:
-				oplots = [Gnuplot.Data(timet,pitcht,with_='lines',
-					title='ground truth')] + oplots
-
-		g = gnuplot_create(outplot=outplot, extension=extension)
-		g('set title \'%s\'' % (re.sub('.*/','',self.input)))
-		g('set size %f,%f' % (xsize,ysize) )
-		g('set multiplot')
-		# hack to align left axis
-		g('set lmargin 4')
-		g('set rmargin 4')
-    # plot waveform
-		time,data = audio_to_array(self.input)
-		wplot = [make_audio_plot(time,data)]
-		g('set origin 0,%f' % (0.7*ysize) )
-		g('set size %f,%f' % (xsize,0.3*ysize))
-		#g('set format y "%1f"')
-		g('set xrange [0:%f]' % max(time)) 
-		g('set yrange [-1:1]') 
-		g('set noytics')
-		g('set y2tics -1,1')
-		g.xlabel('time (s)',offset=(0,0.7))
-		g.ylabel('amplitude')
-		g.plot(*wplot)
-
-		# default settings for next plots
-		g('unset title')
-		g('set format x ""')
-		g('set format y "%3e"')
-		g('set tmargin 0')
-		g.xlabel('')
-		g('set noclip one') 
-
-		if not midi:
-			g('set log y')
-			#g.xlabel('time (s)')
-			g.ylabel('f0 (Hz)')
-			g('set yrange [100:%f]' % self.params.pitchmax) 
-		else: 
-			g.ylabel('midi')
-			g('set yrange [%f:%f]' % (aubio_freqtomidi(self.params.pitchmin), aubio_freqtomidi(self.params.pitchmax)))
-			g('set y2tics %f,%f' % (round(aubio_freqtomidi(self.params.pitchmin)+.5),12))
-		
-		if multiplot:
-			N = len(oplots)
-			y = 0.7*ysize # the vertical proportion of the plot taken by onset functions
-			delta = 0.035 # the constant part of y taken by last plot label and data
-			for i in range(N):
-				# plot pitch detection functions
-				g('set size %f,%f' % ( xsize, (y-delta)/N))
-				g('set origin 0,%f' % ((N-i-1)*(y-delta)/N + delta ))
-				g('set nokey')
-				g('set xrange [0:%f]' % max(time))
-				g.ylabel(titles[i])
-				if i == N-1:
-					g('set size %f,%f' % (xsize, (y-delta)/N + delta ) )
-					g('set origin 0,0')
-					g.xlabel('time (s)', offset=(0,0.7))
-					g('set format x')
-				g.plot(oplots[i])
-		else:
-			g('set key right top')
-			g.plot(*oplots)
-		g('unset multiplot')
-
--- a/python/aubio/task/silence.py
+++ /dev/null
@@ -1,28 +1,0 @@
-from aubio.task.task import task
-from aubio.aubioclass import *
-
-class tasksilence(task):
-	wassilence = 1
-	issilence  = 1
-	def __call__(self):
-		task.__call__(self)
-		if (aubio_silence_detection(self.myvec(),self.params.silence)==1):
-			if self.wassilence == 1: self.issilence = 1
-			else: self.issilence = 2
-			self.wassilence = 1
-		else: 
-			if self.wassilence <= 0: self.issilence = 0
-			else: self.issilence = -1 
-			self.wassilence = 0
-		if self.issilence == -1:
-			return max(self.frameread-self.params.delay,0.), -1
-		elif self.issilence == 2:
-			return max(self.frameread+self.params.delay,0.), 2 
-
-	def fprint(self,foo):
-		print self.params.step*foo[0],
-		if foo[1] == 2: print "OFF"
-		else: print "ON"
-
-
-
--- a/python/aubio/task/task.py
+++ /dev/null
@@ -1,53 +1,0 @@
-from aubio.aubioclass import * 
-from params import taskparams
-
-class task(taskparams):
-	""" default template class to apply tasks on a stream """
-	def __init__(self,input,output=None,params=None):
-		""" open the input file and initialize default argument 
-		parameters should be set *before* calling this method.
-		"""
-		import time
-		self.tic = time.time()
-		if params == None: self.params = taskparams()
-		else: self.params = params
-		self.frameread = 0
-		self.readsize  = self.params.hopsize
-		self.input     = input
-		self.filei     = sndfile(self.input)
-		self.srate     = self.filei.samplerate()
-		self.params.step = float(self.params.hopsize)/float(self.srate)
-		self.myvec     = fvec(self.params.hopsize)
-		self.output    = output
-
-	def __call__(self):
-		self.readsize = self.filei.read(self.params.hopsize,self.myvec)
-		self.frameread += 1
-		
-	def compute_all(self):
-		""" Compute data """
-    		mylist    = []
-		while(self.readsize==self.params.hopsize):
-			tmp = self()
-			if tmp: 
-				mylist.append(tmp)
-				if self.params.verbose:
-					self.fprint(tmp)
-    		return mylist
-	
-	def fprint(self,foo):
-		print foo
-
-	def eval(self,results):
-		""" Eval data """
-		pass
-
-	def plot(self):
-		""" Plot data """
-		pass
-
-	def time(self):
-		import time
-		#print "CPU time is now %f seconds," % time.clock(),
-		#print "task execution took %f seconds" % (time.time() - self.tic)
-		return time.time() - self.tic
--- a/python/aubio/txtfile.py
+++ /dev/null
@@ -1,47 +1,0 @@
-"""Copyright (C) 2004 Paul Brossier <[email protected]>
-print aubio.__LICENSE__ for the terms of use
-"""
-
-__LICENSE__ = """\
-  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
-
-  This file is part of aubio.
-
-  aubio is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  aubio is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
-"""            
-
-def read_datafile(filename,depth=-1):
-    """read list data from a text file (columns of float)"""
-    if filename == '--' or filename == '-':
-        import sys
-        fres = sys.stdin
-    else:
-        fres = open(filename,'ro')
-    l = []
-    while 1:
-        tmp = fres.readline()
-        if not tmp : break
-        else: tmp = tmp.split()
-        if depth > 0:
-            for i in range(min(depth,len(tmp))):
-                tmp[i] = float(tmp[i])
-            l.append(tmp)
-        elif depth == 0:
-            l.append(float(tmp[0]))
-        else:
-            for i in range(len(tmp)):
-                tmp[i] = float(tmp[i])
-            l.append(tmp)
-    return l
-
--- a/python/aubio/web/browser.py
+++ /dev/null
@@ -1,167 +1,0 @@
- #
- # Copyright 2004 Apache Software Foundation 
- # 
- # Licensed under the Apache License, Version 2.0 (the "License"); you
- # may not use this file except in compliance with the License.  You
- # may obtain a copy of the License at
- #
- #      http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- # implied.  See the License for the specific language governing
- # permissions and limitations under the License.
- #
- # Originally developed by Gregory Trubetskoy.
- #
- # $Id: publisher.py,v 1.36 2004/02/16 19:47:27 grisha Exp $
-
-"""
-  This handler is conceputally similar to Zope's ZPublisher, except
-  that it:
-
-  1. Is written specifically for mod_python and is therefore much faster
-  2. Does not require objects to have a documentation string
-  3. Passes all arguments as simply string
-  4. Does not try to match Python errors to HTTP errors
-  5. Does not give special meaning to '.' and '..'.
-
-  This is a modified version of mod_python.publisher.handler Only the first
-  directory argument is matched, the rest is left for path_info. A default
-  one must be provided.
-
-"""
-
-from mod_python import apache
-from mod_python import util
-from mod_python.publisher import resolve_object,process_auth,imp_suffixes
-
-import sys
-import os
-import re
-
-from types import *
-
-def configure_handler(req,default):
-
-    req.allow_methods(["GET", "POST"])
-    if req.method not in ["GET", "POST"]:
-        raise apache.SERVER_RETURN, apache.HTTP_METHOD_NOT_ALLOWED
-
-    func_path = ""
-    if req.path_info:
-        func_path = req.path_info[1:] # skip first /
-        #func_path = func_path.replace("/", ".")
-        #if func_path[-1:] == ".":
-        #    func_path = func_path[:-1] 
-        # changed: only keep the first directory
-        func_path = re.sub('/.*','',func_path)
-
-    # default to 'index' if no path_info was given
-    if not func_path:
-        func_path = "index"
-
-    # if any part of the path begins with "_", abort
-    if func_path[0] == '_' or func_path.count("._"):
-        raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
-
-    ## import the script
-    path, module_name =  os.path.split(req.filename)
-    if not module_name:
-        module_name = "index"
-
-    # get rid of the suffix
-    #   explanation: Suffixes that will get stripped off
-    #   are those that were specified as an argument to the
-    #   AddHandler directive. Everything else will be considered
-    #   a package.module rather than module.suffix
-    exts = req.get_addhandler_exts()
-    if not exts:
-        # this is SetHandler, make an exception for Python suffixes
-        exts = imp_suffixes
-    if req.extension:  # this exists if we're running in a | .ext handler
-        exts += req.extension[1:] 
-    if exts:
-        suffixes = exts.strip().split()
-        exp = "\\." + "$|\\.".join(suffixes)
-        suff_matcher = re.compile(exp) # python caches these, so its fast
-        module_name = suff_matcher.sub("", module_name)
-
-    # import module (or reload if needed)
-    # the [path] argument tells import_module not to allow modules whose
-    # full path is not in [path] or below.
-    config = req.get_config()
-    autoreload=int(config.get("PythonAutoReload", 1))
-    log=int(config.get("PythonDebug", 0))
-    try:
-        module = apache.import_module(module_name,
-                                      autoreload=autoreload,
-                                      log=log,
-                                      path=[path])
-    except ImportError:
-        et, ev, etb = sys.exc_info()
-        # try again, using default module, perhaps this is a
-        # /directory/function (as opposed to /directory/module/function)
-        func_path = module_name
-        module_name = "index"
-        try:
-            module = apache.import_module(module_name,
-                                          autoreload=autoreload,
-                                          log=log,
-                                          path=[path])
-        except ImportError:
-            # raise the original exception
-            raise et, ev, etb
-        
-    # does it have an __auth__?
-    realm, user, passwd = process_auth(req, module)
-
-    # resolve the object ('traverse')
-    try:
-        object = resolve_object(req, module, func_path, realm, user, passwd)
-    except AttributeError:
-        # changed, return the default path instead
-        #raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
-        object = default
-    # not callable, a class or an unbound method
-    if (not callable(object) or 
-        type(object) is ClassType or
-        (hasattr(object, 'im_self') and not object.im_self)):
-
-        result = str(object)
-        
-    else:
-        # callable, (but not a class or unbound method)
-        
-        # process input, if any
-        req.form = util.FieldStorage(req, keep_blank_values=1)
-        
-        result = util.apply_fs_data(object, req.form, req=req)
-
-    if result or req.bytes_sent > 0 or req.next:
-        
-        if result is None:
-            result = ""
-        else:
-            result = str(result)
-
-        # unless content_type was manually set, we will attempt
-        # to guess it
-        if not req._content_type_set:
-            # make an attempt to guess content-type
-            if result[:100].strip()[:6].lower() == '<html>' \
-               or result.find('</') > 0:
-                req.content_type = 'text/html'
-            else:
-                req.content_type = 'text/plain'
-
-        if req.method != "HEAD":
-            req.write(result)
-        else:
-            req.write("")
-        return apache.OK
-    else:
-        req.log_error("mod_python.publisher: %s returned nothing." % `object`)
-        return apache.HTTP_INTERNAL_SERVER_ERROR
-
--- a/python/aubio/web/html.py
+++ /dev/null
@@ -1,286 +1,0 @@
-from aubio.bench.node import *
-
-def parse_args(req):
-    req.basehref = BASEHREF
-    req.datadir = DATADIR
-    if req.path_info: path_info = req.path_info
-    else: path_info = '/'
-    location = re.sub('^/show_[a-z0-9]*/','',path_info)
-    location = re.sub('^/play_[a-z0-9]*/','',location)
-    location = re.sub('^/index/','',location)
-    location = re.sub('^/','',location)
-    location = re.sub('/$','',location)
-    datapath = "%s/%s" % (DATADIR,location)
-    respath  = "%s/%s" % (DATADIR,location)
-    last     = re.sub('/$','',location)
-    last     = last.split('/')[-1]
-    first    = path_info.split('/')[1]
-    # store some of this in the mp_request
-    req.location, req.datapath, req.respath = location, datapath, respath
-    req.first, req.last = first, last
-
-    if location:
-        if not (os.path.isfile(datapath) or 
-		os.path.isdir(datapath) or 
-		location in ['feedback','email']):
-		# the path was not understood
-		from mod_python import apache
-		req.write("<html> path not found %s</html>" % (datapath))
-		raise apache.SERVER_RETURN, apache.OK
-		#from mod_python import apache
-		#raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
-
-def navigation(req):
-    """ main html navigation header """
-    from mod_python import psp
-    req.content_type = "text/html"
-    parse_args(req)
-    datapath = req.datapath
-    location = req.location
-
-    # deal with session
-    if req.sess.is_new():
-	    msg = "<b>Welcome %s</b><br>" % req.sess['login']
-    else:
-	    msg = "<b>Welcome back %s</b><br>" % req.sess['login']
-
-    # start writing
-    tmpl = psp.PSP(req, filename='header.tmpl')
-    tmpl.run(vars = { 'title': "aubioweb / %s / %s" % (req.first,location),
-    		'basehref': '/~piem/',
-		'message': msg,
-    		'action': req.first})
-
-    req.write("<h2>Content of ")
-    print_link(req,"","/")
-    y = location.split('/')
-    for i in range(len(y)-1): 
-    	print_link(req,"/".join(y[:i+1]),y[i])
-	req.write(" / ")
-    req.write("%s</h2>\n" % y[-1])
-
-    a = {'show_info' : 'info',
-    	 'show_sound': 'waveform',
-    	 'show_onset': 'onset',
-    	 'index'     : 'index',
-	 'show_pitch': 'pitch',
-	 'play_m3u': 'stream (m3u/ogg)',
-	 'play_ogg': 'save (ogg)',
-	 'play_wav': 'save (wav)',
-	 }
-
-    # print task lists (only remaining tasks)
-    print_link(req,re.sub('%s.*'%req.last,'',location),"go up")
-    akeys = a.keys(); akeys.sort();
-    curkey = req.first
-    for akey in akeys: 
-        if akey != curkey:
-    		req.write(":: ")
-		print_link(req,"/".join((akey,location)),a[akey])
-	else:
-    		req.write(":: ")
-		req.write("<b>%s</b>" % a[akey])
-    req.write("<br>")
-
-    # list the content of the directories
-    listdir,listfiles = [],[]
-    if os.path.isdir(datapath):
-        listfiles = list_snd_files(datapath)
-    	listdir = list_dirs(datapath)
-	listdir.pop(0) # kick the current dir
-    elif os.path.isfile(datapath):
-        listfiles = [datapath]
-	listdir = [re.sub(req.last,'',location)]
-
-    link_list(req,listdir,title="Subdirectories")
-    link_list(req,listfiles,title="Files")
-
-def footer(req):
-    """ html navigation footer """
-    from mod_python import psp
-    tmpl = psp.PSP(req, filename='footer.tmpl')
-    tmpl.run(vars = { 'time': -req.mtime+req.request_time })
-
-def apply_on_data(req, func,**keywords):
-    # bug: hardcoded snd file filter
-    act_on_data(func,req.datapath,req.respath,
-    	filter="f  -maxdepth 1 -name '*.wav' -o -name '*.aif'",**keywords)
-
-def print_link(req,target,name,basehref=BASEHREF):
-    req.write("<a href='%s/%s'>%s</a>\n" % (basehref,target,name))
-
-def print_img(req,target,name='',basehref=BASEHREF):
-    if name == '': name = target
-    req.write("<img src='%s/%s' alt='%s' title='%s'>\n" % (basehref,target,name,name))
-
-def link_list(req,targetlist,basehref=BASEHREF,title=None):
-    if len(targetlist) > 1:
-        if title: req.write("<h3>%s</h3>"%title)
-        req.write('<ul>')
-        for i in targetlist:
-            s = re.split('%s/'%DATADIR,i,maxsplit=1)[1]
-            if s: 
-        	req.write('<li>')
-	    	print_link(req,s,s)
-        	req.write('</li>')
-        req.write('</ul>')
-
-def print_list(req,list):
-    req.write("<pre>\n")
-    for i in list: req.write("%s\n" % i)
-    req.write("</pre>\n")
-
-def print_command(req,command):
-    req.write("<h4>%s</h4>\n" % re.sub('%%','%',command))
-    def print_runcommand(input,output):
-        cmd = re.sub('(%)?%i','%s' % input, command)
-        cmd = re.sub('(%)?%o','%s' % output, cmd)
-        print_list(req,runcommand(cmd))
-    apply_on_data(req,print_runcommand)
-
-def datapath_to_location(input):
-    location = re.sub(DATADIR,'',input)
-    return re.sub('^/*','',location)
-
-## drawing hacks
-def draw_func(req,func):
-    import re
-    req.content_type = "image/png"
-    # build location (strip the func_path, add DATADIR)
-    location = re.sub('^/draw_[a-z]*/','%s/'%DATADIR,req.path_info)
-    location = re.sub('.png$','',location)
-    if not os.path.isfile(location):
-	from mod_python import apache
-	raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
-    # replace location in func
-    cmd = re.sub('(%)?%i','%s' % location, func)
-    # add PYTHONPATH at the beginning, 
-    cmd = "%s%s 2> /dev/null" % (PYTHONPATH,cmd)
-    for each in runcommand(cmd):
-	req.write("%s\n"%each)
-
-def show_task(req,task):
-    def show_task_file(input,output,task):
-        location = datapath_to_location(input)
-        print_img(req,"draw_%s/%s" % (task,location))
-    navigation(req)
-    req.write("<h3>%s</h3>\n" % task)
-    apply_on_data(req,show_task_file,task=task)
-    footer(req)
-
-## waveform_foo
-def draw_sound(req):
-    draw_func(req,"aubioplot-audio %%i stdout 2> /dev/null")
-
-def show_sound(req):
-    show_task(req,"sound")
-
-## pitch foo
-def draw_pitch(req,threshold='0.3'):
-    draw_func(req,"aubiopitch -i %%i -p -m schmitt,yin,fcomb,mcomb -t %s -O stdout" % threshold)
-
-def show_pitch(req):
-    show_task(req,"pitch")
-
-## onset foo
-def draw_onset(req,threshold='0.3'):
-    draw_func(req,"aubiocut -i %%i -p -m complex -t %s -O stdout" % threshold)
-
-def show_onset(req,threshold='0.3',details=''):
-    def onset_file(input,output):
-        location = datapath_to_location(input)
-        print_img(req,"draw_onset/%s?threshold=%s"%(location,threshold))
-        print_link(req,"?threshold=%s" % (float(threshold)-0.1),"-")
-        req.write("%s\n" % threshold)
-        print_link(req,"?threshold=%s" % (float(threshold)+0.1),"+")
-	# bug: hardcoded sndfile extension 
-        anote = re.sub('\.wav$','.txt',input)
-	if anote == input: anote = ""
-        res = get_extract(input,threshold)
-        if os.path.isfile(anote):
-            tru = get_anote(anote)
-            print_list(req,get_results(tru,res,0.05))
-        else:
-            req.write("no ground truth found<br>\n")
-        if details:
-            req.write("<h4>Extraction</h4>\n")
-            print_list(req,res)
-        else:
-            req.write("<a href='%s/show_onset/%s?details=yes&amp;threshold=%s'>details</a><br>\n" %
-            	(req.basehref,location,threshold))
-        if details and os.path.isfile(anote):
-            req.write("<h4>Computed differences</h4>\n")
-            ldiffs = get_diffs(tru,res,0.05)
-            print_list(req,ldiffs)
-            req.write("<h4>Annotations</h4>\n")
-            print_list(req,tru)
-    navigation(req)
-    req.write("<h3>Onset</h3>\n")
-    apply_on_data(req,onset_file)
-    footer(req)
-
-def get_anote(anote):
-    import aubio.onsetcompare
-    # FIXME: should import with txtfile.read_datafile
-    return aubio.onsetcompare.load_onsets(anote)
-
-def get_diffs(anote,extract,tol):
-    import aubio.onsetcompare
-    return aubio.onsetcompare.onset_diffs(anote,extract,tol)
-
-def get_extract(datapath,threshold='0.3'):
-    cmd = "%saubiocut -v -m complex -t %s -i %s" % (PYTHONPATH,threshold,datapath)
-    lo = runcommand(cmd)
-    for i in range(len(lo)): lo[i] = float(lo[i])
-    return lo
-
-def get_results(anote,extract,tol):
-    import aubio.onsetcompare
-    orig, missed, merged, expc, bad, doubled = aubio.onsetcompare.onset_roc(anote,extract,tol)
-    s =("GD %2.8f\t"        % (100*float(orig-missed-merged)/(orig)),
-        "FP %2.8f\t"        % (100*float(bad+doubled)/(orig))       , 
-        "GD-merged %2.8f\t" % (100*float(orig-missed)/(orig))       , 
-        "FP-pruned %2.8f\t" % (100*float(bad)/(orig))		    )
-    return s
-
-# play m3u foo
-def play_m3u(req):
-    def show_task_file(input,output,task):
-        location = datapath_to_location(input)
-        req.write("http://%s%s/play_ogg/%s\n" % (HOSTNAME,BASEHREF,re.sub("play_m3u",task,location)))
-    req.content_type = "audio/mpegurl"
-    parse_args(req)
-    apply_on_data(req,show_task_file,task="play_ogg")
-
-# play wav foo
-def play_wav(req):
-    req.content_type = "audio/x-wav"
-    func = "cat %%i"
-    # build location (strip the func_path, add DATADIR)
-    location = re.sub('^/play_wav/','%s/'%DATADIR,req.path_info)
-    if not os.path.isfile(location):
-	from mod_python import apache
-	raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
-    # replace location in func
-    cmd = re.sub('(%)?%i','%s' % location, func)
-    # add PYTHONPATH at the beginning, 
-    cmd = "%s 2> /dev/null" % cmd
-    for each in runcommand(cmd):
-	req.write("%s\n"%each)
-
-# play ogg foo
-def play_ogg(req):
-    req.content_type = "application/ogg"
-    func = "oggenc -o - %%i"
-    # build location (strip the func_path, add DATADIR)
-    location = re.sub('^/play_ogg/','%s/'%DATADIR,req.path_info)
-    location = re.sub('.ogg$','',location)
-    if not os.path.isfile(location):
-	from mod_python import apache
-	raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
-    # replace location in func
-    cmd = re.sub('(%)?%i','%s' % location, func)
-    # add PYTHONPATH at the beginning, 
-    cmd = "%s 2> /dev/null" % cmd
-    for each in runcommand(cmd):
-	req.write("%s\n"%each)
--- a/python/aubio/wscript_build
+++ /dev/null
@@ -1,17 +1,0 @@
-# vim:set syntax=python:
-
-pyaubio = ctx.new_task_gen(name = 'python-aubio',
-  features = 'c cshlib pyext',
-  source = '../../swig/aubio.i',
-  add_objects = 'sndfileio',
-  target = '_aubiowrapper',
-  use = ['aubio'],
-  uselib = ['SNDFILE'],
-  swig_flags = '-python -Wall',
-  includes = '. ../../src ../../examples')
-pyaubio.install_path = '${PYTHONDIR}/${PACKAGE}'
-
-# install python files 
-ctx.install_files('${PYTHONDIR}/${PACKAGE}/', ctx.path.ant_glob('**/*.py'))
-# install swig generated python file
-ctx.install_files('${PYTHONDIR}/${PACKAGE}/', '../../swig/aubiowrapper.py')
--- a/python/aubiocompare-onset
+++ /dev/null
@@ -1,114 +1,0 @@
-#! /usr/bin/python
-
-"""Copyright (C) 2004 Paul Brossier <[email protected]>
-
-print aubio.__LICENSE__ for the terms of use
-
-or see LICENSE.txt in the aubio installation directory.
-"""
-__LICENSE__ = """\
-  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
-
-  This file is part of aubio.
-
-  aubio is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  aubio is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
-"""            
-
-
-__HELP__ = """\
-# required arguments
- -c targetfilename 
- -o detectfilename 
-(both must be text files with 1 time a line expressed in seconds)
-
-# optional arguments
- -D <delay>  	delay in seconds
- -v 		verbose mode
- -d 		debug mode
-
-# output 
-results:number of correct detections
-        number of incorrect detections
-        number of doubled detections
-        number of total detections
-        number of total targets
-
-# example:
-$ aubioonset-comp -c checked-onsets.txt -o handlab-onsets.txt -v
-( gd fp dd ) tot / real
-( 5 4 0 ) 9 / 9
-55.5555555556 %GD       44.4444444444 %FP       0.0 %OD
-
-# bugs
-does not scale to very long lists
-"""
-
-import sys
-from aubio.onsetcompare import onset_roc, onset_diffs
-from aubio.txtfile import read_datafile
-
-# default values
-fileo=None;filec=None;vmode=None;dmode=None;delay=0.
-# default tolerance is 50 ms
-#tol = 0.050
-tol = 0.048
-# default mode is onset
-mode = 'onset'
-
-while len(sys.argv) >=2:
-    option = sys.argv[1]; del sys.argv[1]
-    if option == '-h': print __HELP__; sys.exit()
-    if option == '-o': fileo = sys.argv[1]; del sys.argv[1]
-    if option == '-c': filec = sys.argv[1]; del sys.argv[1]
-    if option == '-v': vmode = 'verbose'
-    if option == '-d': dmode = 'debug'
-    if option == '-D': delay = float(sys.argv[1]); del sys.argv[1] 
-    if option == '-tol': tol = float(sys.argv[1]); del sys.argv[1] 
-    if option == '-l': mode = 'localisation'
-
-# arguments required
-if (not fileo) or (not filec):
-    print 'wrong set of arguments. use \'-h\' for help' 
-    sys.exit('error: needs at least \'-c targets.txt -o detected.txt\'')
-
-# load files
-ltru, lres = read_datafile(fileo,depth=0),read_datafile(filec,depth=0)
-
-# delay onsets as required with -D
-if delay:
-    for i in range(len(lres)):
-        lres[i] = lres[i] + delay
-# compute errors types
-if mode == 'localisation':
-	l = onset_diffs(ltru,lres,tol)
-	for i in l: print "%.3f" % i
-else:
-	orig, missed, merged, expc, bad, doubled = onset_roc(ltru,lres,tol)
-	
-	# print results
-	#print "orig, missed, merged, expc, bad, doubled:"
-	if vmode=='verbose':
-	    print "orig", orig
-            print "expc", expc
-            print "missed",missed
-            print "merged", merged
-            print "bad", bad
-            print "doubled", doubled
-            print "correct", orig-missed-merged
-	    print "GD %2.8f\t"        % (100*float(orig-missed-merged)/(orig)),
-	    print "FP %2.8f\t"        % (100*float(bad+doubled)/(orig))       , 
-	    print "GD-merged %2.8f\t" % (100*float(orig-missed)/(orig))       , 
-	    print "FP-pruned %2.8f\t" % (100*float(bad)/(orig))                
-	else:
-	    print  orig, missed, merged, expc, bad, doubled
--- a/python/aubiocut
+++ /dev/null
@@ -1,156 +1,0 @@
-#! /usr/bin/python
-
-""" this file was written by Paul Brossier 
-  it is released under the GNU/GPL license.
-"""
-
-import sys
-from aubio.task import *
-
-usage = "usage: %s [options] -i soundfile" % sys.argv[0]
-
-def parse_args():
-        from optparse import OptionParser
-        parser = OptionParser(usage=usage)
-        parser.add_option("-i","--input",
-                          action="store", dest="filename", 
-                          help="input sound file")
-        parser.add_option("-m","--mode", 
-			  action="store", dest="mode", default='dual', 
-                          help="onset detection mode [default=dual] \
-                          complexdomain|hfc|phase|specdiff|energy|kl|mkl|dual")
-        parser.add_option("-B","--bufsize",
-                          action="store", dest="bufsize", default=512, 
-                          help="buffer size [default=512]")
-        parser.add_option("-H","--hopsize",
-                          action="store", dest="hopsize", default=256, 
-                          help="overlap size [default=256]")
-        parser.add_option("-t","--threshold",
-                          action="store", dest="threshold", default=0.3, 
-                          help="onset peak picking threshold [default=0.3]")
-        parser.add_option("-C","--dcthreshold",
-                          action="store", dest="dcthreshold", default=1., 
-                          help="onset peak picking DC component [default=1.]")
-        parser.add_option("-s","--silence",
-                          action="store", dest="silence", default=-70, 
-                          help="silence threshold [default=-70]")
-        parser.add_option("-M","--mintol",
-                          action="store", dest="mintol", default=0.048, 
-                          help="minimum inter onset interval [default=0.048]")
-        parser.add_option("-D","--delay",
-                          action="store", dest="delay",  
-                          help="number of seconds to take back [default=system]\
-                          default system delay is 3*hopsize/samplerate")
-        parser.add_option("-L","--localmin",
-                          action="store_true", dest="localmin", default=False, 
-                          help="use local minima after peak detection")
-        parser.add_option("-c","--cut",
-                          action="store_true", dest="cut", default=False,
-                          help="cut input sound file at detected labels \
-                          best used with option -L")
-        parser.add_option("-d","--derivate",
-                          action="store_true", dest="derivate", default=False, 
-                          help="derivate onset detection function")
-        parser.add_option("-S","--silencecut",
-                          action="store_true", dest="silencecut", default=False,
-                          help="outputs silence locations")
-        parser.add_option("-z","--zerocross",
-                          action="store", dest="zerothres", default=0.008, 
-                          help="zero-crossing threshold for slicing [default=0.00008]")
-        # plotting functions
-        parser.add_option("-p","--plot",
-                          action="store_true", dest="plot", default=False, 
-                          help="draw plot")
-        parser.add_option("-x","--xsize",
-                          action="store", dest="xsize", default=1., 
-                          type='float', help="define xsize for plot")
-        parser.add_option("-y","--ysize",
-                          action="store", dest="ysize", default=1., 
-                          type='float', help="define ysize for plot")
-        parser.add_option("-f","--function",
-                          action="store_true", dest="func", default=False, 
-                          help="print detection function")
-        parser.add_option("-n","--no-onsets",
-                          action="store_true", dest="nplot", default=False, 
-                          help="do not plot detected onsets")
-        parser.add_option("-O","--outplot",
-                          action="store", dest="outplot", default=None, 
-                          help="save plot to output.{ps,png}")
-        parser.add_option("-F","--spectrogram",
-                          action="store_true", dest="spectro", default=False,
-                          help="add spectrogram to the plot")
-        parser.add_option("-v","--verbose",
-                          action="store_true", dest="verbose", default=True,
-                          help="make lots of noise [default]")
-        parser.add_option("-q","--quiet",
-                          action="store_false", dest="verbose", default=True, 
-                          help="be quiet")
-        # to be implemented
-        parser.add_option("-b","--beat",
-                          action="store_true", dest="beat", default=False,
-                          help="output beat locations")
-        (options, args) = parser.parse_args()
-        if not options.filename: 
-                 print "no file name given\n", usage
-                 sys.exit(1)
-        return options, args
-
-options, args = parse_args()
-
-filename   = options.filename
-params = taskparams()
-params.hopsize    = int(options.hopsize)
-params.bufsize    = int(options.bufsize)
-params.threshold  = float(options.threshold)
-params.dcthreshold = float(options.dcthreshold)
-params.zerothres  = float(options.zerothres)
-params.silence    = float(options.silence)
-params.mintol     = float(options.mintol)
-params.verbose    = options.verbose
-# default take back system delay
-if options.delay: params.delay = int(float(options.delay)/params.step)
-
-dotask = taskonset
-if options.beat:
-	dotask = taskbeat
-elif options.silencecut:
-	dotask = tasksilence
-elif options.plot or options.func: 
-	params.storefunc=True
-else:              
-	params.storefunc=False
-
-lonsets, lofunc = [], []
-wplot,oplots = [],[]
-modes = options.mode.split(',')
-for i in range(len(modes)):
-	params.onsetmode = modes[i] 
-	filetask = dotask(filename,params=params)
-	onsets = filetask.compute_all()
-
-        #lonsets.append(onsets)
-	if not options.silencecut:
-		ofunc = filetask.ofunc
-		lofunc.append(ofunc)
-
-	if options.plot:
-		if options.beat: 
-			filetask.plot(oplots, onsets)
-		else:
-			filetask.plot(onsets, ofunc, wplot, oplots, nplot=options.nplot)
-
-	if options.func: 
-		for i in ofunc: 
-			print i 
-
-if options.outplot:
-  extension = options.outplot.split('.')[-1] 
-  outplot = '.'.join(options.outplot.split('.')[:-1])
-else:
-  extension,outplot = None,None
-if options.plot: filetask.plotplot(wplot, oplots, outplot=outplot, extension=extension,
-  xsize=options.xsize,ysize=options.ysize,spectro=options.spectro)
-
-if options.cut:
-        a = taskcut(filename,onsets,params=params)
-	a.compute_all()
--- a/python/aubiodiffs-onset
+++ /dev/null
@@ -1,86 +1,0 @@
-#! /usr/bin/python
-
-__LICENSE__ = """\
-  Copyright (C) 2004-2009 Paul Brossier <[email protected]>
-
-  This file is part of aubio.
-
-  aubio is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  aubio is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
-"""            
-
-__HELP__ = """\
-# required arguments
- -c targetfilename 
- -o detectfilename 
-(both must be text files with 1 time a line expressed in seconds)
-
-# optional arguments
- -D <delay>  	delay in seconds
- -v 		verbose mode
- -d 		debug mode
-
-# output 
-results:number of correct detections
-        number of incorrect detections
-        number of doubled detections
-        number of total detections
-        number of total targets
-
-# example:
-$ aubioonset-comp -c checked-onsets.txt -o handlab-onsets.txt -v
-( gd fp dd ) tot / real
-( 5 4 0 ) 9 / 9
-55.5555555556 %GD       44.4444444444 %FP       0.0 %OD
-
-# bugs
-does not scale to very long lists
-"""
-
-import sys
-from aubio.onsetcompare import onset_diffs
-from aubio.txtfile import read_datafile
-
-# default values
-fileo=None;filec=None;vmode=None;dmode=None;delay=0.
-# default tolerance is 50 ms
-#tol = 0.050
-tol = 0.048
-
-while len(sys.argv) >=2:
-    option = sys.argv[1]; del sys.argv[1]
-    if option == '-h': print __HELP__; sys.exit()
-    if option == '-o': fileo = sys.argv[1]; del sys.argv[1]
-    if option == '-c': filec = sys.argv[1]; del sys.argv[1]
-    if option == '-v': vmode = 'verbose'
-    if option == '-d': dmode = 'debug'
-    if option == '-D': delay = float(sys.argv[1]); del sys.argv[1] 
-    if option == '-tol': tol = float(sys.argv[1]); del sys.argv[1] 
-
-# arguments required
-if (not fileo) or (not filec):
-    print 'wrong set of arguments. use \'-h\' for help' 
-    sys.exit('error: needs at least \'-c targets.txt -o detected.txt\'')
-
-# load files
-ltru, lres = read_datafile(fileo,depth=0),read_datafile(filec,depth=0)
-
-# delay onsets as required with -D
-if delay:
-    for i in range(len(lres)):
-        lres[i] = lres[i] + delay
-# compute errors types
-l = onset_diffs(ltru,lres,tol)
-# print with 1ms precision
-for i in l: print "%.3f" % float(i)
-
--- a/python/aubiofilter-notes
+++ /dev/null
@@ -1,94 +1,0 @@
-#!/usr/bin/python
-
-"""  this file is used to get filter the (old) output format of aubionotes """
-
-# default parameters 
-__eps       = [0.250,0.50]      # minimum length, pitch tolerance (ms,midipitch)
-__plot      = 0                 # -P (command line switch)
-__delay     = 0.0               # -D <value> (fixed delay for score alignement)
-__winlength = 10                # -w <value> (window length for pitch estimation in frames)
-
-import getopt
-import sys
-
-def parse_args (sysargs):
-        from getopt import gnu_getopt
-        shortopts ='i:o:t:p:w:D:P:'
-        longopts =('input=','output=','tolpitch=','toltime=','winlength=','delay','plot=')
-        args,tmp = gnu_getopt(sysargs,shortopts,longopts)
-        assert len(args) > 1
-        plot      = __plot
-        delay     = __delay
-        eps       = __eps
-        winlength = __winlength
-        plot = __plot
-        fileout   = '/tmp/testprint.ps'
-        args.sort()
-        for i in range(len(args)):  # a bad way
-                if args[i][0] == '-i' or args[i][0] == '--input':
-                        fileorg =  args[i][1]
-                if args[i][0] == '-o' or args[i][0] == '--output':
-                        fileerr =  args[i][1]
-                if args[i][0] == '-t' or args[i][0] == '--toltime':
-                        eps[0] = float(args[i][1])
-                if args[i][0] == '-p' or args[i][0] == '--tolpitch':
-                        eps[1] = float(args[i][1])
-                if args[i][0] == '-D' or args[i][0] == '--delay':
-                        delay = float(args[i][1])
-                if args[i][0] == '-w' or args[i][0] == '--winlength':
-                        winlength = int(args[i][1])
-                if args[i][0] == '-P' or args[i][0] == '--plot':
-                        plot = 1
-                        fileout = args[i][1]
-        return fileorg,fileerr,eps,winlength,plot,delay,fileout
-
-def usage():
-        print __file__, "with at least some arguments"
-
-def main(): 
-        try:
-                opts,args = getopt.getopt(sys.argv[1:], 
-                        "hvo:i:p:P", 
-                        ["help", "output=", "verbose", "input=", "plot="])
-        except getopt.GetoptError:
-                usage()
-                sys.exit(2)
-
-        input = None
-        output = None
-        verbose = False
-        winlength = __winlength
-        plot = __plot
-        eps = __eps
-
-        for o, a in opts:
-                if o in ("-v", "--verbose"):
-                        verbose = True
-                if o in ("-h", "--help"):
-                        usage()
-                        sys.exit(2)
-                if o in ("--output"):
-                        output = a
-                if o in ("-i", "--input"):
-                        input = a
-                if o in ("-P", "--plot"):
-                        plot = 1
-
-        assert input != None and input != "", "no input file" 
-
-        from aubio import notefilter,txtfile,gnuplot
-        """ load midi and raw data """
-        from numpy import array
-        notelist = array(txtfile.read_datafile(input))
-        """ filter it out """
-        notelist_filtered = notefilter.segraw_onsets4(notelist,winlength,eps)
-        if verbose == 1 : 
-                for a,b in notelist_filtered:
-                        print a,b
-        """ plot results """
-        if plot == 1  : 
-                gnuplot.plotnote(notelist_filtered,title=input,fileout=output)
-        
-if __name__ == "__main__":
-        main()
-
--- a/python/aubionotes
+++ /dev/null
@@ -1,79 +1,0 @@
-#!/usr/bin/python
-
-def do(filein,threshold):
-
-    import aubio.aubioclass
-    import aubio.median
-    from math import floor
-    hopsize   = 512
-    bufsize   = 4096
-    channels  = 1
-    frameread = 0
-    silthres  = -80.
-    filei     = aubio.aubioclass.sndfile(filein)
-    srate     = filei.samplerate()
-    myvec     = aubio.aubioclass.fvec(hopsize,channels)
-    readsize  = filei.read(hopsize,myvec)
-    ppick     = aubio.aubioclass.pitchpick(bufsize,hopsize,channels,myvec,srate)
-    opick     = aubio.aubioclass.onsetpick(bufsize,hopsize,channels,myvec,threshold)
-    mylist    = list()
-
-    wassilence = 0
-    lastpitch = 0
-    starttime = 0
-    while(readsize==hopsize):
-        readsize = filei.read(hopsize,myvec)
-        val = ppick.do(myvec)
-        midival = aubio.aubioclass.bintomidi(val,srate,bufsize) 
-        isonset,onset = opick.do(myvec) 
-        now = (frameread)*hopsize/(srate+0.)
-        issilence = aubio.aubioclass.aubio_silence_detection(myvec.vec,silthres)
-        
-        estmidival = 0
-        if (issilence == 1):
-            if (wassilence == 0):
-                #outputnow
-                endtime = (frameread-3)*hopsize/(srate+0.)
-                if len(mylist) > 5 :
-                    estmidival = aubio.median.percental(mylist,len(mylist)/2)
-                    print "sil", starttime, endtime, estmidival
-                #resetnow
-                mylist = list()
-            else:
-                wassilence = 1
-        else:
-            if isonset == 1:
-                if (wassilence == 0):
-                    #outputnow
-                    endtime = (frameread-3)*hopsize/(srate+0.)
-                    #estmidival = aubio.median.percental(around(array(mylist)),len(mylist)//2)
-                    if len(mylist) > 5 :
-                        estmidival = aubio.median.percental(mylist,len(mylist)/2)
-                        print starttime, endtime, estmidival
-                #resetnow
-                mylist = list()
-                #store start time
-                starttime = (frameread-3)*hopsize/(srate+0.)
-            else:
-                """
-                if(listfull):
-                    #outputnow
-                    endtime = (frameread-3)*hopsize/(srate+0.)
-                    print starttime, endtime, estimmidival
-                else:
-                """
-                #bufferize
-                if midival > 50 and midival < 75:
-                    mylist.append(floor(midival))
-            wassilence = 0
-                    
-            
-        #elif( midival > 45 ):
-        #    mylist.append(( now , midival+12 ))
-        #mylist.append(toappend)
-        frameread += 1
-
-
-if __name__ == "__main__":
-    import sys
-    do(sys.argv[1],sys.argv[2])
--- a/python/aubiopitch
+++ /dev/null
@@ -1,131 +1,0 @@
-#!/usr/bin/python
-
-""" this file was written by Paul Brossier 
-  it is released under the GNU/GPL license.
-"""
-
-import sys
-from aubio.task import *
-
-usage = "usage: %s [options] -i soundfile" % sys.argv[0]
-
-
-def parse_args():
-  from optparse import OptionParser
-  parser = OptionParser(usage=usage)
-  parser.add_option("-i","--input",
-      action="store", dest="filename", 
-      help="input sound file")
-  parser.add_option("-m","--mode", 
-      action="store", dest="mode", default='yinfft',
-      help="pitch detection mode [default=mcomb] \
-      mcomb|yin|fcomb|schmitt")
-  parser.add_option("-u","--units",
-      action="store", dest="omode", default="freq",
-      help="output pitch in units [default=Hz] \
-      freq|midi|cent|bin")
-  parser.add_option("-B","--bufsize",
-      action="store", dest="bufsize", default=None, 
-      help="buffer size [default=2048]")
-  parser.add_option("-H","--hopsize",
-      action="store", dest="hopsize", default=None, 
-      help="overlap size [default=512]")
-  parser.add_option("-t","--threshold",
-      action="store", dest="threshold", default=0.1, 
-      help="pitch threshold (for yin) [default=0.1]")
-  parser.add_option("-s","--silence",
-      action="store", dest="silence", default=-70, 
-      help="silence threshold [default=-70]")
-  parser.add_option("-D","--delay",
-      action="store", dest="delay",  
-      help="number of seconds frames to take back [default=0]")
-  parser.add_option("-S","--smoothing",
-      action="store", dest="smoothing", default=False, 
-      help="use a median filter of N frames [default=0]")
-  parser.add_option("-M","--maximum",
-      action="store", dest="pitchmax", default=False, 
-      help="maximum pitch value to look for (Hz) [default=20000]")
-  parser.add_option("-l","--minimum",
-      action="store", dest="pitchmin", default=False, 
-      help="minimum pitch value to look for (Hz) [default=20]")
-  # to be implemented
-  parser.add_option("-n","--note",
-      action="store_true", dest="note", default=False,
-      help="NOT IMPLEMENTED output notes")
-  # plotting functions
-  parser.add_option("-T","--plottruth",
-      action="store_true", dest="plottruth", default=False, 
-      help="draw plot of the ground truth pitch track")
-  parser.add_option("-p","--plot",
-      action="store_true", dest="plot", default=False, 
-      help="draw plot of the pitch track")
-  parser.add_option("-x","--xsize",
-      action="store", dest="xsize", default=1., 
-      type='float', help="define xsize for plot")
-  parser.add_option("-y","--ysize",
-      action="store", dest="ysize", default=1., 
-      type='float', help="define ysize for plot")
-  parser.add_option("-O","--outplot",
-      action="store", dest="outplot", default=None, 
-      help="save the plot to output.{ps,png,svg} instead of displaying it")
-  parser.add_option("-v","--verbose",
-      action="store_true", dest="verbose", default=True,
-      help="make lots of noise")
-  parser.add_option("-q","--quiet",
-      action="store_false", dest="verbose", default=True, 
-      help="be quiet")
-  (options, args) = parser.parse_args()
-  if not options.bufsize:
-    if options.mode == "yin":     options.bufsize = 1024
-    if options.mode == "schmitt": options.bufsize = 2048
-    if options.mode == "mcomb":   options.bufsize = 4096
-    if options.mode == "fcomb":   options.bufsize = 4096 
-    else: options.bufsize = 2048
-  if not options.hopsize:
-    options.hopsize = float(options.bufsize) / 2
-  if not options.filename: 
-    print "no file name given\n", usage
-    sys.exit(1)
-  return options, args
-
-options, args = parse_args()
-
-#print options.bufsize, options.hopsize
-
-filename   = options.filename
-params = taskparams()
-params.samplerate = float(sndfile(filename).samplerate())
-params.hopsize    = int(options.hopsize)
-params.bufsize    = int(options.bufsize)
-params.step       = params.samplerate/float(params.hopsize)
-params.yinthresh  = float(options.threshold)
-params.silence    = float(options.silence)
-params.verbose    = options.verbose
-if options.smoothing: params.pitchsmooth = int(options.smoothing)
-if options.pitchmax:  params.pitchmax    = int(options.pitchmax)
-if options.pitchmin:  params.pitchmin    = int(options.pitchmin)
-#mintol     = float(options.mintol)*step
-# default take back system delay
-if options.delay: params.pitchdelay = float(options.delay)
-
-if options.note:
-        exit("not implemented yet")
-
-wplot,oplots,titles = [],[],[]
-modes = options.mode.split(',')
-for i in range(len(modes)):
-	pitch = []
-	params.pitchmode  = modes[i]
-	filetask = taskpitch(filename,params=params)
-	pitch = filetask.compute_all()
-	#print filetask.eval(pitch[i]) 
-	if options.plot: filetask.plot(pitch,wplot,oplots,titles)
-
-if options.outplot:
-  extension = options.outplot.split('.')[-1] 
-  outplot = '.'.join(options.outplot.split('.')[:-1])
-else:
-  extension,outplot = None,None
-if options.plot: 
-	filetask.plotplot(wplot,oplots,titles,outplot=outplot,extension=extension,
-  xsize=options.xsize,ysize=options.ysize,truth=options.plottruth)
--- a/python/aubioplot-audio
+++ /dev/null
@@ -1,31 +1,0 @@
-#!/usr/bin/python
-
-import sys
-from aubio.gnuplot import gnuplot_create,gnuplot_addargs,plot_audio
-
-usage = "usage: %s [options] -i soundfile" % sys.argv[0]
-
-def parse_args():
-        from optparse import OptionParser
-        parser = OptionParser(usage=usage)
-        parser.add_option("-i","--input",
-                          action="store", dest="filename", 
-                          help="input sound file")
-        gnuplot_addargs(parser)
-        (options, args) = parser.parse_args()
-        if not options.filename: 
-                 print "no file name given\n", usage
-                 sys.exit(1)
-        return options, args
-
-options, args = parse_args()
-
-if options.outplot: 
-  extension = options.outplot.split('.')[-1] 
-  outplot = '.'.join(options.outplot.split('.')[:-1])
-else: 
-  extension = ''
-  outplot = None
-
-g = gnuplot_create(outplot,extension,options)
-plot_audio(options.filename.split(','), g, options)
--- a/python/aubioplot-notes
+++ /dev/null
@@ -1,31 +1,0 @@
-#!/usr/bin/python
-
-def parse_args (sysargs):
-        from getopt import gnu_getopt
-        shortopts ='i:o:'
-        longopts =('input=','output=')
-        args,tmp = gnu_getopt(sysargs,shortopts,longopts)
-        args.sort()
-        filein,fileout= None,None
-        for i in range(len(args)):  # a bad way
-                if args[i][0] == '-i' or args[i][0] == '--input':
-                        filein =  args[i][1]
-                if args[i][0] == '-o' or args[i][0] == '--output':
-                        fileout =  args[i][1]
-        assert filein != None, 'precise filein'
-        return filein,fileout
-
-def main (sysargs) :
-    from aubio.txtfile import read_datafile
-    from aubio.gnuplot import plotnote,plotnote_do 
-    from numpy import array
-    filein,fileout = parse_args(sysargs)
-    #print 'checking', fileerr, 'against', fileorg
-    """ load midi and raw data """
-    d = plotnote(array(read_datafile(filein)),title=filein)
-    plotnote_do(d,fileout=fileout)
-
-if __name__ == "__main__":
-    import sys 
-    main(sys.argv[1:])
-
--- a/python/aubioplot-spec
+++ /dev/null
@@ -1,51 +1,0 @@
-#! /usr/bin/python
-
-""" this file was written by Paul Brossier 
-  it is released under the GNU/GPL license.
-"""
-
-import sys
-from aubio.gnuplot import gnuplot_create,gnuplot_addargs,plot_spec 
-
-usage = "usage: %s [options] -i soundfile" % sys.argv[0]
-
-def parse_args():
-        from optparse import OptionParser
-        parser = OptionParser(usage=usage)
-        parser.add_option("-i","--input",
-                          action="store", dest="filename", 
-                          help="input sound file")
-        parser.add_option("-M","--maxf",
-                          action="store", dest="maxf", default=10000., 
-                          type='float',help="higher frequency limit")
-        parser.add_option("-L","--minf",
-                          action="store", dest="minf", default=0., 
-                          type='float',help="lower frequency limit")
-        parser.add_option("-l","--log",
-                          action="store_true", dest="log", default=False, 
-                          help="plot on a logarithmic scale")
-        parser.add_option("-B","--bufsize", type='int',
-                          action="store", dest="bufsize", default=8192, 
-                          help="buffer size [default=8192]")
-        parser.add_option("-H","--hopsize", type='int',
-                          action="store", dest="hopsize", default=1024, 
-                          help="overlap size [default=1024]")
-        gnuplot_addargs(parser)
-        (options, args) = parser.parse_args()
-        if not options.filename: 
-                 print "no file name given\n", usage
-                 sys.exit(1)
-        return options, args
-
-options, args = parse_args()
-filename = options.filename
-
-if options.outplot: 
-  extension = options.outplot.split('.')[-1] 
-  outplot = '.'.join(options.outplot.split('.')[:-1])
-else: 
-  extension = ''
-  outplot = None
-
-g = gnuplot_create(outplot,extension,options)
-plot_spec(filename, g, options)
--- a/python/aubioplot-yinfft
+++ /dev/null
@@ -1,135 +1,0 @@
-#! /usr/bin/python
-
-""" this file was written by Paul Brossier 
-  it is released under the GNU/GPL license.
-"""
-
-import sys,time
-from aubio.task import task,taskparams
-from aubio.aubioclass import fvec
-from aubio.gnuplot import gnuplot_create
-from aubio.aubiowrapper import *
-
-usage = "usage: %s [options] -i soundfile" % sys.argv[0]
-
-def parse_args():
-        from optparse import OptionParser
-        parser = OptionParser(usage=usage)
-        parser.add_option("-i","--input",
-                          action="store", dest="filename", 
-                          help="input sound file")
-        parser.add_option("-n","--printframe",
-                          action="store", dest="printframe", default=-1, 
-                          help="make a plot of the n_th frame")
-        parser.add_option("-x","--xsize",
-                          action="store", dest="xsize", default=1., 
-                          help="define xsize for plot")
-        parser.add_option("-y","--ysize",
-                          action="store", dest="ysize", default=1., 
-                          help="define ysize for plot")
-        parser.add_option("-O","--outplot",
-                          action="store", dest="outplot", default=None, 
-                          help="save plot to output.{ps,png}")
-        (options, args) = parser.parse_args()
-        if not options.filename: 
-                 print "no file name given\n", usage
-                 sys.exit(1)
-        return options, args
-
-def plotdata(x,y,plottitle="",**keyw):
-	import Gnuplot
-	return Gnuplot.Data(x, y, title="%s" % plottitle,**keyw)
-
-options, args = parse_args()
-filename = options.filename
-xsize = float(options.xsize)
-ysize = float(options.ysize)*2
-
-printframe = int(options.printframe)
-if printframe == -1:
-  print "Will wait for ^D to skip to next plot"
-  print "Press enter before to print to file"
-
-
-g = gnuplot_create()
-params = taskparams()
-params.hopsize = 2048 # 512 
-params.bufsize = params.hopsize #2048
-taskfile = task(filename,params=params)
-
-yin = fvec(params.bufsize/2,1)
-
-t = [i for i in range(params.bufsize)]
-a = [0 for i in range(params.bufsize)]
-
-while (taskfile.readsize == params.hopsize):
-  taskfile()
-
-  n = [i for i in range(params.bufsize/2)]
-  a = [taskfile.myvec.get(i,0) for i in range(params.hopsize/2)]
-  aubio_pitchyin_diff(taskfile.myvec(),yin()) # compute d[t]
-  c = [yin.get(i,0) for i in range(params.bufsize/2)]
-  aubio_pitchyin_getcum(yin()) # compute d'[t]
-  y = [yin.get(i,0) for i in range(params.bufsize/2)]
-  thresh = [0.1 for i in range(params.bufsize/2)]
-  #t.append((i/float(params.hopsize)+taskfile.frameread)*params.step),t.pop(0)
-  d = [plotdata(n,a,plottitle="signal", with_='lines'),
-    plotdata(n,c,plottitle="d[t]",axes='x1y2', with_='lines lt 1'),
-    plotdata(n,y,plottitle="d'[t]",axes='x1y1', with_='lines lt 2'),
-    plotdata(n,thresh,plottitle="threshold",axes='x1y1', with_='lines lt 3')]
-  #g('set xrange [%f:%f]' % (t[0],t[-1]))
-  #time.sleep(.2)
-  g.reset()
-  g('set yrange [-1:3]')
-  g('set xrange [0:%d]' % (params.bufsize/2))
-  g('set title \"%s\"' %  "Example of period detection using YIN")
-  if printframe == -1:
-    g.replot(*d)
-    a = sys.stdin.read()
-  if a == "\n" or printframe == taskfile.frameread:
-      from os.path import basename
-      outplot = "_".join([basename(sys.argv[0]),'_'.join(basename(filename).split('.')),"%d" % taskfile.frameread])
-      print outplot
-      f = gnuplot_create(outplot=outplot,extension='ps')
-      f('set size %f,%f;' % (xsize,ysize) )
-      f('set lmargin %f' % (15*xsize))
-      f('set rmargin %f' % (10*xsize))
-      #f('set title \"%s\"' %  "Example of period detection using YIN")
-      f('set multiplot')
-      f.ylabel('amplitude',offset=(+.5,0))
-      f.xlabel('time (samples)')
-      f('set size %f,%f;' % (xsize,ysize*0.4) )
-      f('set orig %f,%f;' % (0,ysize*0.6) )
-      sigmax = max(abs(min(a)),abs(max(a)))
-      f('set yrange [%f:%f]' % (-1.3*sigmax,1.3*sigmax))
-      f('set xrange [0:%d]' % (params.bufsize/2))
-      f.plot(d[0])
-
-      f.ylabel('')
-      f.xlabel('lag (samples)')
-      f('set bmargin %f' % (4*ysize))
-      f('set size %f,%f;' % (xsize,ysize*0.6) )
-      f('set orig %f,%f;' % (0,0) )
-      f('set autoscale')
-      f('set xrange [0:%d]' % (params.bufsize/2))
-      f('set notitle')
-      f('set y2tics')
-      f('set ytics nomirror')
-      f('set noytics')
-      f('set key right')
-      f.plot(d[1])
-
-      f.ylabel('amplitude')
-      f.xlabel('')
-      f('set y2tics nomirror')
-      f('set ytics nomirror')
-      f('set noy2tics')
-      f('set noxtics')
-      f('set ytics')
-      f('set key left')
-      f.plot(d[2],d[3])
-      #f('set yrange [-1:3]')
-      #f.plot(*d)
-      print "saved plot", outplot, 'ps'
-  elif printframe < taskfile.frameread:
-      break
--- a/python/aubioweb.py
+++ /dev/null
@@ -1,113 +1,0 @@
-#!/usr/bin/python
-
-doc = """
-This script works with mod_python to browse a collection of annotated wav files
-and results.
-
-you will need to have at least the following packages need to be installed (the
-name of the command line tool is precised in parenthesis):
-
-libapache-mod-python (apache2 prefered)
-sndfile-programs (sndfile-info)
-vorbis-tools (oggenc)
-python-gnuplot
-python-numpy
-
-Try the command line tools in aubio/python to test your installation.
-
-NOTE: this script is probably horribly insecure.
-
-example configuration for apache to put in your preferred virtual host.
-
-<Directory /home/piem/public_html/aubioweb>
-    # Minimal config
-    AddHandler mod_python .py
-    # Disable these in production
-    PythonDebug On
-    PythonAutoReload on
-    # Default handler in url
-    PythonHandler aubioweb
-    ## Authentication stuff (optional)
-    #PythonAuthenHandler aubioweb
-    #AuthType Basic
-    #AuthName "Restricted Area"
-    #require valid-user
-    # make default listing
-    DirectoryIndex aubioweb/
-</Directory>
-
-"""
-
-from aubio.web.html import *
-
-def handler(req):
-    from aubio.web.browser import *
-    from mod_python import Session
-    req.sess = Session.Session(req)
-    req.sess['login']='new aubio user'
-    req.sess.save()
-    return configure_handler(req,index)
-
-def index(req,threshold='0.3'):
-    navigation(req)
-    print_command(req,"sfinfo %%i")
-    return footer(req)
-
-def show_info(req,verbose=''):
-    navigation(req)
-    print_command(req,"sndfile-info %%i")
-    return footer(req)
-
-def feedback(req):
-    navigation(req)
-    req.write("""
-    Please provide feedback below:
-  <p>                           
-  <form action="/~piem/aubioweb/email" method="POST">
-      Name:    <input type="text" name="name"><br>
-      Email:   <input type="text" name="email"><br>
-      Comment: <textarea name="comment" rows=4 cols=20></textarea><br>
-      <input type="submit">
-  </form>
-    """)
-
-WEBMASTER='piem@calabaza'
-SMTP_SERVER='localhost'
-
-def email(req,name,email,comment):
-    import smtplib
-    # make sure the user provided all the parameters
-    if not (name and email and comment):
-        return "A required parameter is missing, \
-               please go back and correct the error"
-    # create the message text
-    msg = """\
-From: %s                                                                                                                                           
-Subject: feedback
-To: %s
-
-I have the following comment:
-
-%s
-
-Thank You,
-
-%s
-
-""" % (email, WEBMASTER, comment, name)
-    # send it out
-    conn = smtplib.SMTP(SMTP_SERVER)
-    try:
-	conn.sendmail(email, [WEBMASTER], msg)
-    except smtplib.SMTPSenderRefused:
-	return """<html>please provide a valid email</html>"""
-	
-    conn.quit()
-    # provide feedback to the user
-    s = """\
-<html>
-Dear %s,<br>
-Thank You for your kind comments, we
-will get back to you shortly.
-</html>""" % name
-    return s
--- a/python/bench-cluster-test
+++ /dev/null
@@ -1,9 +1,0 @@
-#! /usr/bin/python
-
-from aubio.bench.broadcast import *
-
-run_broadcast(remote_sync,'/home/testing')
-run_broadcast(remote_sync,'/home/testing','-n')
-run_broadcast(fetch_results,'/home/testing','-n')
-
-run_broadcast(remote_queue,'echo coucou')
--- a/python/bench-test
+++ /dev/null
@@ -1,13 +1,0 @@
-#! /usr/bin/python
-
-from aubio.bench.node import *
-
-datapath = '/var/www'
-respath = '/var/tmp'
-
-def my_print(input,output):
-        cmd = "%s %s %s" % ("time sleep 0.3; echo",input,output)
-        return runcommand(cmd,debug=0)
-
-act_on_results(mkdir,datapath,respath,filter='d')
-act_on_data(my_print,datapath,respath,suffix='.txt')
--- a/python/wscript_build
+++ /dev/null
@@ -1,6 +1,0 @@
-# vim:set syntax=python:
-
-ctx.add_subdirs('aubio')
-# install headers
-for file in ['aubiocut', 'aubiopitch']:
-  ctx.install_as('${PREFIX}/bin/' + file, file, chmod = 0755)