Mercurial > hg > midi-score-follower
comparison src/BayesianArrayStructure.cpp @ 1:1a32ce016bb9
Changed bestEstimate timing to work via time sent from Max not the elapsed time. This had caused some problems, but this version now working surprisingly well on MIDI files with variable timing.
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Thu, 18 Aug 2011 23:27:42 +0100 |
parents | b299a65a3ad0 |
children | 5581023e0de4 |
comparison
equal
deleted
inserted
replaced
0:b299a65a3ad0 | 1:1a32ce016bb9 |
---|---|
244 if (index >= 0 && index < relativeSpeedPrior.length){ | 244 if (index >= 0 && index < relativeSpeedPrior.length){ |
245 //then we can do update | 245 //then we can do update |
246 | 246 |
247 //set new likelihood | 247 //set new likelihood |
248 relativeSpeedLikelihood.zero(); | 248 relativeSpeedLikelihood.zero(); |
249 relativeSpeedLikelihood.addConstant(0.02); | 249 relativeSpeedLikelihood.addConstant(0.05); |
250 | 250 |
251 relativeSpeedLikelihood.addGaussianShape(index , 5, 0.5*matchFactor); | 251 relativeSpeedLikelihood.addGaussianShape(index , 5, 0.5*matchFactor); |
252 | 252 |
253 | 253 |
254 //copy posterior to prior | 254 //copy posterior to prior |
366 relativeString += ": index "+ofToString(startArrayIndex)+" , "+ofToString(endArrayIndex)+" ["; | 366 relativeString += ": index "+ofToString(startArrayIndex)+" , "+ofToString(endArrayIndex)+" ["; |
367 // relativeString += ofToString(prior.getIndexInRealTerms(endArrayIndex), 3)+"] (sc-width:"+ofToString(screenWidthMillis, 1)+") "; | 367 // relativeString += ofToString(prior.getIndexInRealTerms(endArrayIndex), 3)+"] (sc-width:"+ofToString(screenWidthMillis, 1)+") "; |
368 relativeString += " mapped to screen "+ofToString(startScreenPosition)+" , "+ofToString(endScreenPosition); | 368 relativeString += " mapped to screen "+ofToString(startScreenPosition)+" , "+ofToString(endScreenPosition); |
369 ofDrawBitmapString(relativeString, 100, 180); | 369 ofDrawBitmapString(relativeString, 100, 180); |
370 | 370 |
371 ofSetColor(0, 200, 0); | 371 ofSetColor(255, 255, 0); |
372 likelihood.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); | 372 likelihood.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); |
373 | 373 |
374 ofSetColor(0,0,200); | 374 ofSetColor(0,0,200); |
375 prior.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); | 375 prior.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); |
376 | 376 |
377 ofSetColor(200, 0, 0); | 377 ofSetColor(200, 0, 0); |
378 posterior.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); | 378 posterior.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); |
379 | 379 |
380 | |
380 // ofSetColor(0, 200, 255); | 381 // ofSetColor(0, 200, 255); |
381 // acceleration.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); | 382 // acceleration.drawConstrainedVector(startArrayIndex, endArrayIndex, startScreenPosition, endScreenPosition); |
382 | 383 |
383 | 384 |
384 } | 385 } |