# HG changeset patch # User Andrew N Robertson # Date 1319635546 -3600 # Node ID 5897a5626f1f1cc8978d9b4d6390f4a918cb3af4 # Parent df9c838d0b8f4c5b97f58d29ee16cdb663eaf410 gave prior to tempo so it prefers original speed diff -r df9c838d0b8f -r 5897a5626f1f src/midiEventHolder.cpp --- a/src/midiEventHolder.cpp Tue Oct 25 15:01:52 2011 +0100 +++ b/src/midiEventHolder.cpp Wed Oct 26 14:25:46 2011 +0100 @@ -208,10 +208,10 @@ bayesStruct.calculatePosterior(); //having found matches we have matches for new note and matches for previous notes - if (!confidenceWeightingUsed) + //if (!confidenceWeightingUsed) findLocalTempoPairs(); - else - findLocalTempoPairsWeightedForConfidence(); + //else + //findLocalTempoPairsWeightedForConfidence(); //bayesStruct.addGaussianNoiseToSpeedPosterior(10); @@ -293,7 +293,7 @@ if (abs(recordedEventTimes[startIndex] - bayesStruct.bestEstimate) < tmpError){ //record the error between expected and observed times tmpError = abs(recordedEventTimes[startIndex] - bayesStruct.bestEstimate); - minimumMatchError = recordedEventTimes[startIndex] - bayesStruct.bestEstimate; + minimumMatchError = tmpError;//recordedEventTimes[startIndex] - bayesStruct.bestEstimate; } } @@ -368,6 +368,10 @@ double speedRatio = recordedTimeDifference / playedTimeDifference; if (speedRatio <= maximumMatchSpeed && speedRatio >= minimumMatchSpeed){ + //adding in a prior that prefers 1 + double priorWeighting = sin(speedRatio * PI/2); + + /* printf("(%i)", matchMatrix[currentPlayedIndex][i+1]); printf("[%i] :: ", recordedPreviousIndex); @@ -379,6 +383,7 @@ //bayesStruct.updateTempoDistribution(speedRatio, 0.1);//second paramter is confidence in the match double amount = (1-bayesStruct.speedLikelihoodNoise)/10; + amount *= priorWeighting; bayesStruct.updateTempoLikelihood(speedRatio, amount); needToUpdate = true; }