Changeset 50e99cc
- Timestamp:
- Dec 19, 2005, 9:56:54 PM (19 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 7c9ad74
- Parents:
- b7eb9a5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/aubio/bench/node.py
rb7eb9a5 r50e99cc 20 20 21 21 def list_files(datapath,filter='f', maxdepth = -1): 22 if not os.path.exists(datapath): 23 print 24 print "ERR: no directory %s were found" % datapath 25 sys.exit(1) 22 26 if maxdepth >= 0: maxstring = " -maxdepth %d " % maxdepth 23 27 else: maxstring = "" … … 28 32 return list_files(datapath, filter="f -name '*.wav'",maxdepth = maxdepth) 29 33 34 sndfile_filter = "f -name '*.wav' -o -name '*.aif' -o -name '*.aiff'" 35 30 36 def list_snd_files(datapath,maxdepth = -1): 31 return list_files(datapath, filter= "f -name '*.wav' -o -name '*.aif'",37 return list_files(datapath, filter=sndfile_filter, 32 38 maxdepth = maxdepth) 33 39 … … 73 79 74 80 class bench: 75 81 """ class to run benchmarks on directories """ 76 82 def __init__(self,datadir,resdir=None,checkres=False,checkanno=False): 77 83 self.datadir = datadir … … 86 92 print "Listing directories in data directory", 87 93 self.dirlist = list_dirs(self.datadir) 88 print " (%d elements)" % len(self.dirlist) 89 #for each in self.dirlist: print each 94 if self.dirlist: 95 print " (%d elements)" % len(self.dirlist) 96 else: 97 print " (0 elements)" 98 print "ERR: no directory %s were found" % self.datadir 99 sys.exit(1) 90 100 print "Listing sound files in data directory", 91 101 self.sndlist = list_snd_files(self.datadir) 92 print " (%d elements)" % len(self.sndlist) 102 if self.sndlist: 103 print " (%d elements)" % len(self.sndlist) 104 else: 105 print " (0 elements)" 106 print "ERR: no sound files were found in", self.datadir 107 sys.exit(1) 93 108 #for each in self.sndlist: print each 94 109 … … 113 128 print 114 129 130 def dir_exec(self): 131 """ run file_exec on every input file """ 132 self.orig, self.missed, self.merged, self.expc, \ 133 self.bad, self.doubled = 0, 0, 0, 0, 0, 0 134 act_on_data(self.file_exec,self.datadir,self.resdir, \ 135 suffix='',filter=sndfile_filter) 136 137 def dir_eval(self): 138 pass 139 140 def file_exec(self): 141 pass 142 143 def file_eval(self): 144 pass 145 146 def file_plot(self): 147 pass 148 149 def dir_plot(self): 150 pass 151 152 def run_bench(self): 153 for mode in self.modes: 154 self.params.mode = mode 155 self.dir_exec() 156 self.dir_eval() 157 self.dir_plot()
Note: See TracChangeset
for help on using the changeset viewer.