- Timestamp:
- Feb 23, 2006, 3:14:30 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:
- 2d975cf
- Parents:
- 0baafcf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/aubio/tasks.py
r0baafcf r37f0352 207 207 self.samplerate = 44100 208 208 self.tol = 0.05 209 self.mintol = 0.0 209 210 self.step = float(self.hopsize)/float(self.samplerate) 210 211 self.threshold = 0.1 … … 299 300 floatpit = self.input.split('.')[-2] 300 301 try: 301 return float(floatpit)302 return aubio_miditofreq(float(floatpit)) 302 303 except ValueError: 303 304 print "ERR: no truth file found" … … 305 306 306 307 def eval(self,results): 308 def mmean(l): 309 return sum(l)/max(float(len(l)),1) 310 307 311 from median import short_find 308 312 self.truth = self.gettruth() 309 num = 0310 sum = 0311 313 res = [] 312 314 for i in results: 313 315 if i == -1: pass 314 316 else: 315 res.append(i) 316 sum += i 317 num += 1 318 if num == 0: 319 avg = 0; med = 0 317 res.append(self.truth-i) 318 if not res: 319 avg = self.truth; med = self.truth 320 320 else: 321 avg = aubio_freqtomidi(sum / float(num)) 322 med = aubio_freqtomidi(short_find(res,len(res)/2)) 323 avgdist = self.truth - avg 324 meddist = self.truth - med 325 return avgdist, meddist 321 avg = mmean(res) 322 med = short_find(res,len(res)/2) 323 return self.truth, self.truth-med, self.truth-avg 326 324 327 325 def plot(self,pitch,outplot=None): … … 351 349 self.d,self.d2 = [],[] 352 350 self.maxofunc = 0 351 self.last = 0 353 352 if self.params.localmin: 354 353 self.ovalist = [0., 0., 0., 0., 0.] … … 377 376 if now < 0 : 378 377 now = 0 379 return now, val 378 if self.params.mintol: 379 #print now - self.last, self.params.mintol 380 if (now - self.last) > self.params.mintol: 381 self.last = now 382 return now, val 383 else: 384 return now, val 380 385 381 386
Note: See TracChangeset
for help on using the changeset viewer.