Mercurial > hg > midi-score-follower
diff src/BayesianArrayStructure.h @ 0:b299a65a3ad0
start project
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Tue, 16 Aug 2011 11:29:59 +0100 |
parents | |
children | 5581023e0de4 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/BayesianArrayStructure.h Tue Aug 16 11:29:59 2011 +0100 @@ -0,0 +1,72 @@ +/* + * BayesianArrayStructure.h + * midiCannamReader + * + * Created by Andrew on 17/07/2011. + * Copyright 2011 QMUL. All rights reserved. + * + */ + +#include "ofMain.h" +//#include "DynamicBayesianArray.h" +#include "DynamicVector.h" + +class BayesianArrayStructure { + +public: +// BayesianArrayStructure(); + BayesianArrayStructure(); + BayesianArrayStructure(int length); + + void calculatePosterior(); + void drawArrays(); + void drawArraysRelativeToTimeframe(const double& startTimeMillis, const double& endTimeMillis); + + void drawTempoArrays(); + + void resetSize(int length); + void resetArrays(); + void simpleExample(); + + double screenWidth; + + void copyPriorToPosterior(); +// DynamicBayesianArray bayesArray; + + double lastEventTime; + + DynamicVector tmpPrior; + + DynamicVector prior; + DynamicVector posterior; + DynamicVector likelihood; + + DynamicVector relativeSpeedPrior; + DynamicVector relativeSpeedLikelihood; + DynamicVector relativeSpeedPosterior; + DynamicVector acceleration; + + void resetSpeedToOne(); + + double bestEstimate; + void updateBestEstimate(); +// double lastBestEstimateUpdateTime; + + double speedDecayWidth, speedDecayAmount; + void decaySpeedDistribution(double timeDifference); + + void resetSpeedSize(int length); + void setRelativeSpeedScalar(double f); + void calculateNewPriorOffset(const double& timeDifference); + void setNewDistributionOffsets(const double& newOffset); + + void updateTempoDistribution(const double& speedRatio, const double& matchFactor); + + void setFlatTempoLikelihood(); + void calculateTempoUpdate(); + void updateTempoLikelihood(const double& speedRatio, const double& matchFactor); + + void crossUpdateArrays(DynamicVector& position, DynamicVector& speed, double timeDifference); + +}; +