comparison src/midiEventHolder.cpp @ 22:9860abc92a30

follower has confidence measure now just using best match. Difficulty in visualising the speed likelihood fn
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Wed, 30 Nov 2011 11:48:35 +0000
parents 11e3119ce6b4
children 5a11b19906c7
comparison
equal deleted inserted replaced
21:11e3119ce6b4 22:9860abc92a30
10 #include "midiEventHolder.h" 10 #include "midiEventHolder.h"
11 11
12 midiEventHolder::midiEventHolder(){ 12 midiEventHolder::midiEventHolder(){
13 // recordedNoteOnIndex = 0; 13 // recordedNoteOnIndex = 0;
14 14
15 useTempoPrior = true;//puts sine wave round tempo 15 useTempoPrior = false;//puts sine wave round tempo
16 16 confidenceWeightingUsed = true;
17 runningInRealTime = false; 17
18 //there is option to use MAP estinate or integral in beayesianarraystricture class
19
20 runningInRealTime = true;
18 bayesStruct.realTimeMode = &runningInRealTime; 21 bayesStruct.realTimeMode = &runningInRealTime;
22
23 minimumMatchSpeed = 0.0;
24 maximumMatchSpeed = 2.0;
25 minimumTimeIntervalForTempoUpdate = 150;
19 26
20 width = ofGetWidth(); 27 width = ofGetWidth();
21 height = ofGetHeight(); 28 height = ofGetHeight();
22 screenWidth= &width; 29 screenWidth= &width;
23 screenHeight = &height; 30 screenHeight = &height;
26 tickLocation = 0; 33 tickLocation = 0;
27 pulsesPerQuarternote = 240; 34 pulsesPerQuarternote = 240;
28 noteArrayIndex = 0; 35 noteArrayIndex = 0;
29 noteMinimum = 30; 36 noteMinimum = 30;
30 noteMaximum = 96; 37 noteMaximum = 96;
31 38
32 minimumMatchSpeed = 0.0; 39
33 maximumMatchSpeed = 2.0;
34 40
35 likelihoodWidth = 100;//using 100 is good 41 likelihoodWidth = 100;//using 100 is good
36 likelihoodToNoiseRatio = 0.08;//was 0.02 on 18/11/11, changing to give more weight to observations 42 likelihoodToNoiseRatio = 0.08;//was 0.02 on 18/11/11, changing to give more weight to observations
37 43
38 bayesStruct.speedLikelihoodNoise = 0.1;//was 0.05 44 bayesStruct.speedLikelihoodNoise = 0.1;//was 0.05
41 47
42 48
43 49
44 speedPriorValue = 1.0; 50 speedPriorValue = 1.0;
45 51
46 matchWindowWidth = 8000;//window size for matching in ms 52 matchWindowWidth = 12000;//window size for matching in ms
47 53
48 bayesStruct.resetSize(matchWindowWidth); 54 bayesStruct.resetSize(matchWindowWidth);
49 bayesStruct.setPositionDistributionScalar(1); 55 bayesStruct.setPositionDistributionScalar(1);
50 56
51 bayesStruct.resetSpeedSize(200); 57 bayesStruct.resetSpeedSize(200);
56 62
57 speedWindowWidthMillis = 4000; 63 speedWindowWidthMillis = 4000;
58 speedPriorValue = 1.0; 64 speedPriorValue = 1.0;
59 noteHeight = (*screenHeight) / (float)(noteMaximum - noteMinimum); 65 noteHeight = (*screenHeight) / (float)(noteMaximum - noteMinimum);
60 66
61 confidenceWeightingUsed = false; 67
62 68
63 drawPhaseMode = true; 69 drawPhaseMode = true;
64 70
65 printf("lookup index %f value %f\n", bayesStruct.prior.getLookupIndex(100, 30., 10.0), bayesStruct.prior.gaussianLookupTable[(int)bayesStruct.prior.getLookupIndex(100, 30., 10.0)]); 71 printf("lookup index %f value %f\n", bayesStruct.prior.getLookupIndex(100, 30., 10.0), bayesStruct.prior.gaussianLookupTable[(int)bayesStruct.prior.getLookupIndex(100, 30., 10.0)]);
66 } 72 }
102 108
103 //played events: 109 //played events:
104 playedEventTimes.clear(); 110 playedEventTimes.clear();
105 playedNoteOnMatrix.clear(); 111 playedNoteOnMatrix.clear();
106 matchMatrix.clear(); 112 matchMatrix.clear();
113 bestMatchFound.clear();
107 } 114 }
108 115
109 void midiEventHolder::printNotes(){ 116 void midiEventHolder::printNotes(){
110 printf("RECORDED MATRIX\n"); 117 printf("RECORDED MATRIX\n");
111 for (int i = 0;i < recordedNoteOnMatrix.size();i++){ 118 for (int i = 0;i < recordedNoteOnMatrix.size();i++){
121 double midiEventHolder::getEventTimeMillis(double ticks){ 128 double midiEventHolder::getEventTimeMillis(double ticks){
122 return (period * ticks / (double) pulsesPerQuarternote); 129 return (period * ticks / (double) pulsesPerQuarternote);
123 } 130 }
124 131
125 void midiEventHolder::newNoteOnEvent(int pitch, int velocity, double timePlayed){ 132 void midiEventHolder::newNoteOnEvent(int pitch, int velocity, double timePlayed){
133 tempoSpeedString = "";
126 134
127 //MOVE INTO BAYESSTRUCT?? XXX 135 //MOVE INTO BAYESSTRUCT?? XXX
128 //bayesStruct.copyPriorToPosterior(); 136 //bayesStruct.copyPriorToPosterior();
129 //why was this here?? 137 //why was this here??
130 bayesStruct.prior.copyFromDynamicVector(bayesStruct.posterior);//try the otehr way 138 bayesStruct.prior.copyFromDynamicVector(bayesStruct.posterior);//try the otehr way
215 int numberOfMatchesFound = findLocalMatches(pitch); 223 int numberOfMatchesFound = findLocalMatches(pitch);
216 setMatchLikelihoods(numberOfMatchesFound); 224 setMatchLikelihoods(numberOfMatchesFound);
217 bayesStruct.calculatePosterior(); 225 bayesStruct.calculatePosterior();
218 226
219 //having found matches we have matches for new note and matches for previous notes 227 //having found matches we have matches for new note and matches for previous notes
220 //if (!confidenceWeightingUsed) 228 if (!confidenceWeightingUsed)
221 findLocalTempoPairs(); 229 findLocalTempoPairs();
222 //else 230 else
223 //findLocalTempoPairsWeightedForConfidence(); 231 findLocalTempoPairsWeightedForConfidence();
224 232
225 //bayesStruct.addGaussianNoiseToSpeedPosterior(10); 233 //bayesStruct.addGaussianNoiseToSpeedPosterior(10);
226 234
227 } 235 }
228 236
294 while (startIndex < recordedEventTimes.size() && recordedEventTimes[startIndex] < endTime){ 302 while (startIndex < recordedEventTimes.size() && recordedEventTimes[startIndex] < endTime){
295 if (recordedNoteOnMatrix[startIndex][1] == notePitch){ 303 if (recordedNoteOnMatrix[startIndex][1] == notePitch){
296 304
297 matchesFound.push_back(startIndex); 305 matchesFound.push_back(startIndex);
298 v.push_back(startIndex); 306 v.push_back(startIndex);
307 //so startIndex is registered as a match
308
299 double eventConfidence = bayesStruct.posterior.getValueAtMillis(recordedEventTimes[startIndex]); 309 double eventConfidence = bayesStruct.posterior.getValueAtMillis(recordedEventTimes[startIndex]);
300 if (eventConfidence > minimumConfidence){ 310 if (eventConfidence > minimumConfidence){
301 minimumConfidence = eventConfidence; 311 minimumConfidence = eventConfidence;
302 bestMatchIndex = startIndex; 312 bestMatchIndex = startIndex;
303 } 313 }
321 // printf("%i MATCHES TO Note %i found\n", (int)matchesFound.size(), notePitch); 331 // printf("%i MATCHES TO Note %i found\n", (int)matchesFound.size(), notePitch);
322 int size = matchesFound.size(); 332 int size = matchesFound.size();
323 if (size > 0) 333 if (size > 0)
324 noteOnMatches[bestMatchIndex] = true; 334 noteOnMatches[bestMatchIndex] = true;
325 335
326 v.insert(v.begin() , (int)size); 336 v.insert(v.begin() , (int)size);//at beginning, we list how many matches there are that we have found
327 d.insert(d.begin() , (double)size); 337 d.insert(d.begin() , (double)size);
328 338
329 //v.push_back(size); 339 //v.push_back(size);
330 //d.push_back(size); 340 //d.push_back(size);
331 //for (int i = 0;i < matchesFound.size()+1;i++){ 341 //for (int i = 0;i < matchesFound.size()+1;i++){
335 345
336 346
337 matchMatrix.push_back(v); 347 matchMatrix.push_back(v);
338 matchConfidence.push_back(d); 348 matchConfidence.push_back(d);
339 349
350 //bringing in way to list only the best matches and use these in tempo process
351 bestMatchFound.push_back(bestMatchIndex);
352
340 printf("BEST MATCH TO note %i, start time %i, endtime %i, time %i is recorded time %i, confidence %0.2f\n", notePitch, startTime, endTime, (int) recordedEventTimes[bestMatchIndex], minimumConfidence); 353 printf("BEST MATCH TO note %i, start time %i, endtime %i, time %i is recorded time %i, confidence %0.2f\n", notePitch, startTime, endTime, (int) recordedEventTimes[bestMatchIndex], minimumConfidence);
341 354
342 return size; 355 return size;
343 } 356 }
344 357
375 388
376 while (previousIndex >= 0 && playedEventTimes[previousIndex] + speedWindowWidthMillis > playedEventTimes[currentPlayedIndex]) { 389 while (previousIndex >= 0 && playedEventTimes[previousIndex] + speedWindowWidthMillis > playedEventTimes[currentPlayedIndex]) {
377 double playedTimeDifference = playedEventTimes[currentPlayedIndex] - playedEventTimes[previousIndex]; 390 double playedTimeDifference = playedEventTimes[currentPlayedIndex] - playedEventTimes[previousIndex];
378 391
379 for (int k = 0;k < matchMatrix[previousIndex][0];k++){ 392 for (int k = 0;k < matchMatrix[previousIndex][0];k++){
393
380 int recordedPreviousIndex = matchMatrix[previousIndex][k+1]; 394 int recordedPreviousIndex = matchMatrix[previousIndex][k+1];
381 395
382
383 double recordedTimeDifference = recordedEventTimes[recordedCurrentIndex] - recordedEventTimes[recordedPreviousIndex]; 396 double recordedTimeDifference = recordedEventTimes[recordedCurrentIndex] - recordedEventTimes[recordedPreviousIndex];
384 397
385 398
386 //we want the speed of the recording relative to that of the playing live 399 //we want the speed of the recording relative to that of the playing live
387 400
388 double speedRatio = recordedTimeDifference / playedTimeDifference; 401 double speedRatio = recordedTimeDifference / playedTimeDifference;
389 if (speedRatio <= maximumMatchSpeed && speedRatio >= minimumMatchSpeed){ 402 if (recordedTimeDifference > minimumTimeIntervalForTempoUpdate &&
403 speedRatio <= maximumMatchSpeed && speedRatio >= minimumMatchSpeed){
404
390 //adding in a prior that prefers 1 405 //adding in a prior that prefers 1
391 double priorWeighting = 1; 406 double priorWeighting = 1;
392 if (useTempoPrior) 407 if (useTempoPrior)
393 priorWeighting = sin(speedRatio * PI/2); 408 priorWeighting = sin(speedRatio * PI/2);
394 409
405 420
406 //bayesStruct.updateTempoDistribution(speedRatio, 0.1);//second paramter is confidence in the match 421 //bayesStruct.updateTempoDistribution(speedRatio, 0.1);//second paramter is confidence in the match
407 double amount = (1-bayesStruct.speedLikelihoodNoise)/10; 422 double amount = (1-bayesStruct.speedLikelihoodNoise)/10;
408 amount *= priorWeighting; 423 amount *= priorWeighting;
409 bayesStruct.updateTempoLikelihood(speedRatio, amount); 424 bayesStruct.updateTempoLikelihood(speedRatio, amount);
425 tempoSpeedString += ofToString(recordedPreviousIndex) + " "+ ofToString(speedRatio, 2) + " "+ofToString(amount, 2) += " \n";
410 needToUpdate = true; 426 needToUpdate = true;
411 } 427 }
412 // printf("\n"); 428 // printf("\n");
413 } 429 }
414 430
423 } 439 }
424 440
425 441
426 void midiEventHolder::findLocalTempoPairsWeightedForConfidence(){ 442 void midiEventHolder::findLocalTempoPairsWeightedForConfidence(){
427 bool needToUpdate = false; 443 bool needToUpdate = false;
444
445 //adapted this to just use the best match for each note
428 446
429 int currentPlayedIndex = playedNoteOnMatrix.size()-1; 447 int currentPlayedIndex = playedNoteOnMatrix.size()-1;
430 // printf("played %i : %i, vel %i\n", currentPlayedIndex, playedNoteOnMatrix[currentPlayedIndex][0], playedNoteOnMatrix[currentPlayedIndex][1]); 448 // printf("played %i : %i, vel %i\n", currentPlayedIndex, playedNoteOnMatrix[currentPlayedIndex][0], playedNoteOnMatrix[currentPlayedIndex][1]);
431 // printMatchesFound(); 449 // printMatchesFound();
432 // printMatchMatrix(); 450 // printMatchMatrix();
433 // printf("possible notes \n"); 451 // printf("possible notes \n");
434 452
435 bayesStruct.setLikelihoodToConstant(); 453 bayesStruct.setLikelihoodToConstant();
436 454
437 for (int i = 0;i < matchMatrix[currentPlayedIndex][0];i++){ 455 int recordedCurrentIndex = bestMatchFound[currentPlayedIndex];
438 //iterate through the recently matched events - even dodgy matches included 456 //we only look at intervals between the current best match and other recent best matched notes
439 //size, index of match0, index of match1, .... 457 //that is the difference in confidence method
440 int recordedCurrentIndex = matchMatrix[currentPlayedIndex][i+1]; 458
441 459
442 double currentMatchConfidence = matchConfidence[currentPlayedIndex][i+1];//new confidence 460 printf("BEST MATCH FOUND for index %i is %i ", currentPlayedIndex, bestMatchFound[currentPlayedIndex]);
443 461
444 int previousIndex = currentPlayedIndex-1; 462 int previousIndex = currentPlayedIndex-1;
445 463
464 //withing speedwindow i.e. 4 seconds
446 while (previousIndex >= 0 && playedEventTimes[previousIndex] + speedWindowWidthMillis > playedEventTimes[currentPlayedIndex]) { 465 while (previousIndex >= 0 && playedEventTimes[previousIndex] + speedWindowWidthMillis > playedEventTimes[currentPlayedIndex]) {
447 double playedTimeDifference = playedEventTimes[currentPlayedIndex] - playedEventTimes[previousIndex]; 466 double playedTimeDifference = playedEventTimes[currentPlayedIndex] - playedEventTimes[previousIndex];
448 467
449 for (int k = 0;k < matchMatrix[previousIndex][0];k++){ 468 int recordedPreviousIndex = bestMatchFound[previousIndex];
450 int recordedPreviousIndex = matchMatrix[previousIndex][k+1]; 469
451 470 double recordedTimeDifference = recordedEventTimes[recordedCurrentIndex] - recordedEventTimes[recordedPreviousIndex];
452 double previousMatchConfidence = matchConfidence[previousIndex][k+1];
453
454
455 double recordedTimeDifference = recordedEventTimes[recordedCurrentIndex] - recordedEventTimes[recordedPreviousIndex];
456 471
457 472
458 //we want the speed of the recording relative to that of the playing live 473 //we want the speed of the recording relative to that of the playing live
459 474
460 double speedRatio = recordedTimeDifference / playedTimeDifference; 475 double speedRatio = recordedTimeDifference / playedTimeDifference;
461 if (speedRatio <= maximumMatchSpeed && speedRatio >= minimumMatchSpeed){ 476 if (recordedTimeDifference > minimumTimeIntervalForTempoUpdate
462 477 && speedRatio < maximumMatchSpeed && speedRatio > minimumMatchSpeed){
463 printf("(%i)", matchMatrix[currentPlayedIndex][i+1]); 478
479 printf("(%i)", previousIndex);
464 printf("[%i] :: ", recordedPreviousIndex); 480 printf("[%i] :: ", recordedPreviousIndex);
465 printf(" conf %f & %f ", currentMatchConfidence, previousMatchConfidence); 481 // printf(" conf %f & %f ", currentMatchConfidence, previousMatchConfidence);
466 printf(" rec{%f} vs play(%f) ", recordedTimeDifference, playedTimeDifference); 482 printf(" rec{%f} vs play(%f) ", recordedTimeDifference, playedTimeDifference);
467 printf("update on speed ratio %f\n", speedRatio); 483 printf("update on speed ratio %f\n", speedRatio);
468 484
469 // matchString += " speed: "+ofToString(speedRatio, 3); 485 // matchString += " speed: "+ofToString(speedRatio, 3);
470 // commented for debug 486 // commented for debug
471 double weighting = previousMatchConfidence * currentMatchConfidence ; 487
472 double amount = (1-bayesStruct.speedLikelihoodNoise)*weighting/10; 488
489 double priorWeighting = 1;
490
491 if (useTempoPrior)
492 priorWeighting = sin(speedRatio * PI/2);//adding in a prior that prefers 1.0 speed
493
494
495 // double weighting = previousMatchConfidence * currentMatchConfidence ;
496 double amount = (1-bayesStruct.speedLikelihoodNoise)*priorWeighting/16;//was 9
473 bayesStruct.updateTempoLikelihood(speedRatio, amount);//second paramter is confidence in the match 497 bayesStruct.updateTempoLikelihood(speedRatio, amount);//second paramter is confidence in the match
498
499 tempoSpeedString += ofToString(recordedCurrentIndex) + " :: " + ofToString(recordedPreviousIndex);
500 tempoSpeedString += " " + ofToString(recordedTimeDifference)+ " " + ofToString(speedRatio, 2) + " "+ofToString(amount, 2) += " \n";
501
474 needToUpdate = true; 502 needToUpdate = true;
475 } 503 }
476 // printf("\n"); 504 // printf("\n");
505
506
507 previousIndex--;
508 }//end while previousindex countdown
509
510 if (needToUpdate)
511 bayesStruct.updateTempoDistribution();
512 //printf("current speed is %f\n", bayesStruct.relativeSpeedPosterior.getIndexInRealTerms(bayesStruct.relativeSpeedPosterior.MAPestimate));
513 }
514
515 /*
516 void midiEventHolder::findLocalTempoPairsWeightedForConfidence(){
517 bool needToUpdate = false;
518
519 //adapted this to just use the best match for each note
520
521 int currentPlayedIndex = playedNoteOnMatrix.size()-1;
522 // printf("played %i : %i, vel %i\n", currentPlayedIndex, playedNoteOnMatrix[currentPlayedIndex][0], playedNoteOnMatrix[currentPlayedIndex][1]);
523 // printMatchesFound();
524 // printMatchMatrix();
525 // printf("possible notes \n");
526
527 bayesStruct.setLikelihoodToConstant();
528
529 for (int i = 0;i < matchMatrix[currentPlayedIndex][0];i++){
530
531 //iterate through the recently matched events - even dodgy matches included
532 //size, index of match0, index of match1, ....
533 int recordedCurrentIndex = matchMatrix[currentPlayedIndex][i+1];
534
535 double currentMatchConfidence = matchConfidence[currentPlayedIndex][i+1];//new confidence
536
537 int previousIndex = currentPlayedIndex-1;
538
539 while (previousIndex >= 0 && playedEventTimes[previousIndex] + speedWindowWidthMillis > playedEventTimes[currentPlayedIndex]) {
540 double playedTimeDifference = playedEventTimes[currentPlayedIndex] - playedEventTimes[previousIndex];
541
542 // for (int k = 0;k < matchMatrix[previousIndex][0];k++)
543 int recordedPreviousIndex = bestMatchFound[previousIndex];//matchMatrix[previousIndex][k+1];
544
545 //double previousMatchConfidence = matchConfidence[previousIndex][k+1];
546
547
548 double recordedTimeDifference = recordedEventTimes[recordedCurrentIndex] - recordedEventTimes[recordedPreviousIndex];
549
550
551 //we want the speed of the recording relative to that of the playing live
552
553 double speedRatio = recordedTimeDifference / playedTimeDifference;
554 if (speedRatio <= maximumMatchSpeed && speedRatio >= minimumMatchSpeed){
555
556 printf("(%i)", matchMatrix[currentPlayedIndex][i+1]);
557 printf("[%i] :: ", recordedPreviousIndex);
558 // printf(" conf %f & %f ", currentMatchConfidence, previousMatchConfidence);
559 printf(" rec{%f} vs play(%f) ", recordedTimeDifference, playedTimeDifference);
560 printf("update on speed ratio %f\n", speedRatio);
561
562 // matchString += " speed: "+ofToString(speedRatio, 3);
563 // commented for debug
564
565
566 double priorWeighting = 1;
567
568 if (useTempoPrior)
569 priorWeighting = sin(speedRatio * PI/2);//adding in a prior that prefers 1.0 speed
570
571
572 // double weighting = previousMatchConfidence * currentMatchConfidence ;
573 double amount = (1-bayesStruct.speedLikelihoodNoise)*priorWeighting/10;
574 bayesStruct.updateTempoLikelihood(speedRatio, amount);//second paramter is confidence in the match
575 tempoSpeedString += ofToString(recordedPreviousIndex) + " " + ofToString(speedRatio, 2) + " "+ofToString(amount, 2) += " \n";
576
577 needToUpdate = true;
477 } 578 }
579 // printf("\n");
580
478 581
479 previousIndex--; 582 previousIndex--;
480 }//end while previousindex countdown 583 }//end while previousindex countdown
481 }//end for loop through possible current matches 584 }//end for loop through possible current matches
482 585
483 if (needToUpdate) 586 if (needToUpdate)
484 bayesStruct.updateTempoDistribution(); 587 bayesStruct.updateTempoDistribution();
485 //printf("current speed is %f\n", bayesStruct.relativeSpeedPosterior.getIndexInRealTerms(bayesStruct.relativeSpeedPosterior.MAPestimate)); 588 //printf("current speed is %f\n", bayesStruct.relativeSpeedPosterior.getIndexInRealTerms(bayesStruct.relativeSpeedPosterior.MAPestimate));
486 } 589 }
487 590 */
488 591
489 592
490 void midiEventHolder::updatePlayPosition(){ 593 void midiEventHolder::updatePlayPosition(){
491 594
492 //in actual fact if we are changing the speed of the play position 595 //in actual fact if we are changing the speed of the play position
540 while (minNoteIndexToPrint > 0 && recordedNoteOnMatrix[minNoteIndexToPrint][0] > numberOfScreensIn*ticksPerScreen)//&& minNoteIndexToPrint < size 643 while (minNoteIndexToPrint > 0 && recordedNoteOnMatrix[minNoteIndexToPrint][0] > numberOfScreensIn*ticksPerScreen)//&& minNoteIndexToPrint < size
541 minNoteIndexToPrint--; 644 minNoteIndexToPrint--;
542 645
543 for (int tmpIndex = max(0,minNoteIndexToPrint);tmpIndex < min(maxNoteIndexToPrint, (int)recordedNoteOnMatrix.size());tmpIndex++){ 646 for (int tmpIndex = max(0,minNoteIndexToPrint);tmpIndex < min(maxNoteIndexToPrint, (int)recordedNoteOnMatrix.size());tmpIndex++){
544 647
648 ofSetColor(255,255,255);
545 if (checkIfMatchedNote(tmpIndex)) 649 if (checkIfMatchedNote(tmpIndex))
546 ofSetColor(0,0,255); 650 ofSetColor(100,100,100);//0,0,255);
547 else if(noteOnMatches[tmpIndex]){ 651 else if(noteOnMatches[tmpIndex]){
548 ofSetColor(255,0,255); 652 ofSetColor(255,0,255);//dark grey
549 }else{
550 ofSetColor(255,255,255);
551 } 653 }
552 654 else{
655 ofSetColor(255,255,255);//255,255,255);
656 }
657
658 //ofSetColor(255,255,255);
553 if (tmpIndex == bestMatchIndex) 659 if (tmpIndex == bestMatchIndex)
554 ofSetColor(255,0,0);//best recent match is in red 660 ofSetColor(255,0,0);//best recent match is in red
555 661
556 // XXX replace ofgetwidth below 662 // XXX replace ofgetwidth below
557 //if (tmpIndex >= 0 && tmpIndex < size) 663 //if (tmpIndex >= 0 && tmpIndex < size)
568 int xLocation;// = getLocationFromTicks(tickLocation); 674 int xLocation;// = getLocationFromTicks(tickLocation);
569 // ofLine(xLocation, 0, xLocation, (*screenHeight)); 675 // ofLine(xLocation, 0, xLocation, (*screenHeight));
570 676
571 //orange line at best estimate 677 //orange line at best estimate
572 xLocation = getLocationFromMillis(bayesStruct.bestEstimate); 678 xLocation = getLocationFromMillis(bayesStruct.bestEstimate);
573 ofSetColor(250,100,0); 679 ofSetColor(80,80,80);//250,100,0);
574 ofLine(xLocation, 0, xLocation, (*screenHeight)); 680 ofLine(xLocation, 0, xLocation, (*screenHeight));
575 681
576 xLocation = getLocationFromMillis(bayesStruct.tmpBestEstimate); 682 xLocation = getLocationFromMillis(bayesStruct.tmpBestEstimate);
577 ofSetColor(250,100,0); 683 ofSetColor(150,150,150);//250,100,0);
578 ofLine(xLocation, 0, xLocation, (*screenHeight)); 684 ofLine(xLocation, 0, xLocation, (*screenHeight));
579 685
580 686
581 //lines where matching window start and end are 687 //lines where matching window start and end are
582 ofSetColor(0,100,255); 688 ofSetColor(0);//0,100,255);
583 xLocation = getLocationFromMillis(windowStartTime); 689 xLocation = getLocationFromMillis(windowStartTime);
584 ofLine(xLocation, 0, xLocation, (*screenHeight)); 690 ofLine(xLocation, 0, xLocation, (*screenHeight));
585 xLocation = getLocationFromMillis(windowStartTime+matchWindowWidth); 691 xLocation = getLocationFromMillis(windowStartTime+matchWindowWidth);
586 ofLine(xLocation, 0, xLocation, (*screenHeight)); 692 ofLine(xLocation, 0, xLocation, (*screenHeight));
587 693
588 694
589 int maxSize = recordedNoteOnMatrix[size-1][0]; 695 int maxSize = recordedNoteOnMatrix[size-1][0];
590 696
697 ofDrawBitmapString(tempoSpeedString, 20, 20);
591 /* string indexString = "num screens in "+ofToString(numberOfScreensIn)+"; min index to print "+ofToString(minNoteIndexToPrint)+", max index to print "+ofToString(maxNoteIndexToPrint); 698 /* string indexString = "num screens in "+ofToString(numberOfScreensIn)+"; min index to print "+ofToString(minNoteIndexToPrint)+", max index to print "+ofToString(maxNoteIndexToPrint);
592 indexString += " size "+ofToString(size)+" tick loc "+ofToString(tickLocation)+" max size "+ofToString(maxSize); 699 indexString += " size "+ofToString(size)+" tick loc "+ofToString(tickLocation)+" max size "+ofToString(maxSize);
593 ofDrawBitmapString(indexString, 20, 40); 700 ofDrawBitmapString(indexString, 20, 40);
594 */ 701 */
595 } 702 }