Mercurial > hg > midi-score-follower
view src/BayesianArrayStructure.h @ 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 |
line wrap: on
line source
/* * 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); };