Changeset 5d1c070 for python/aubio
- Timestamp:
- Mar 5, 2006, 4:21:16 AM (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:
- d8604ac
- Parents:
- 43938de
- Location:
- python/aubio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/aubio/bench/node.py
r43938de r5d1c070 26 26 if maxdepth >= 0: maxstring = " -maxdepth %d " % maxdepth 27 27 else: maxstring = "" 28 cmd = '%s' * 5 % ('find ',datapath,maxstring,' -type ',filter)28 cmd = '%s' * 6 % ('find ',datapath,maxstring,' -type ',filter, "| sort -n") 29 29 return runcommand(cmd) 30 30 -
python/aubio/task/pitch.py
r43938de r5d1c070 61 61 elif floatpit: 62 62 try: 63 self.truth = aubio_miditofreq(float(floatpit))64 print "ground truth found in filename:", self.truth65 tasksil = tasksilence(self.input )63 self.truth = float(floatpit) 64 #print "ground truth found in filename:", self.truth 65 tasksil = tasksilence(self.input,params=self.params) 66 66 time,pitch =[],[] 67 67 while(tasksil.readsize==tasksil.params.hopsize): … … 84 84 for i in range(len(values)): 85 85 time.append(values[i][0]) 86 pitch.append( values[i][1])86 pitch.append(aubio_freqtomidi(values[i][1])) 87 87 return time,pitch 88 88 89 def eval(self,results):89 def oldeval(self,results): 90 90 def mmean(l): 91 91 return sum(l)/max(float(len(l)),1) … … 105 105 return self.truth, self.truth-med, self.truth-avg 106 106 107 def neweval(self,results):107 def eval(self,pitch,tol=0.9): 108 108 timet,pitcht = self.gettruth() 109 for i in timet: 110 print results[i] 111 return self.truth, self.truth-med, self.truth-avg 109 pitch = [aubio_freqtomidi(i) for i in pitch] 110 for i in range(len(pitch)): 111 if pitch[i] == "nan" or pitch[i] == -1: 112 pitch[i] = -1 113 time = [ i*self.params.step for i in range(len(pitch)) ] 114 assert len(timet) == len(time) 115 assert len(pitcht) == len(pitch) 116 osil, esil, opit, epit, echr = 0, 0, 0, 0, 0 117 for i in range(len(pitcht)): 118 if pitcht[i] == -1: # currently silent 119 osil += 1 # count a silence 120 if pitch[i] == -1. or pitch[i] == "nan": 121 esil += 1 # found a silence 122 else: 123 opit +=1 124 if abs(pitcht[i] - pitch[i]) < tol: 125 epit += 1 126 echr += 1 127 elif abs(pitcht[i] - pitch[i]) % 12. < tol: 128 echr += 1 129 #else: 130 # print timet[i], pitcht[i], time[i], pitch[i] 131 #print "origsilence", "foundsilence", "origpitch", "foundpitch", "orig pitchroma", "found pitchchroma" 132 #print 100.*esil/float(osil), 100.*epit/float(opit), 100.*echr/float(opit) 133 return osil, esil, opit, epit, echr 112 134 113 135 def plot(self,pitch,wplot,oplots,outplot=None): … … 115 137 import Gnuplot 116 138 117 self.eval(pitch)118 139 downtime = self.params.step*numarray.arange(len(pitch)) 119 oplots.append(Gnuplot.Data(downtime,pitch,with='lines ',140 oplots.append(Gnuplot.Data(downtime,pitch,with='linespoints', 120 141 title=self.params.pitchmode)) 121 142 122 143 123 def plotplot(self,wplot,oplots,outplot=None,multiplot = 1):144 def plotplot(self,wplot,oplots,outplot=None,multiplot = 0): 124 145 from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot 125 146 import re … … 132 153 timet,pitcht = self.gettruth() 133 154 if timet and pitcht: 155 pitcht = [aubio_miditofreq(i) for i in pitcht] 134 156 oplots = [Gnuplot.Data(timet,pitcht,with='lines', 135 157 title='ground truth')] + oplots
Note: See TracChangeset
for help on using the changeset viewer.