annotate bayesianArraySrc/BayesianArrayStructure.h @ 0:c4f9e49226eb

Initialising repository. Live osc input registered. Files analysed offline.
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Tue, 31 Jan 2012 13:54:17 +0000
parents
children 45b5cf9be377
rev   line source
andrew@0 1 /*
andrew@0 2 * BayesianArrayStructure.h
andrew@0 3 * midiCannamReader
andrew@0 4 *
andrew@0 5 * Created by Andrew on 17/07/2011.
andrew@0 6 * Copyright 2011 QMUL. All rights reserved.
andrew@0 7 *
andrew@0 8 */
andrew@0 9 #ifndef BAYESIAN_ARRAY_STRUCTURE
andrew@0 10 #define BAYESIAN_ARRAY_STRUCTURE
andrew@0 11
andrew@0 12
andrew@0 13 #include "ofMain.h"
andrew@0 14 //#include "DynamicBayesianArray.h"
andrew@0 15 #include "DynamicVector.h"
andrew@0 16
andrew@0 17 class BayesianArrayStructure {
andrew@0 18
andrew@0 19 public:
andrew@0 20 // BayesianArrayStructure();
andrew@0 21 BayesianArrayStructure();
andrew@0 22 BayesianArrayStructure(int length);
andrew@0 23
andrew@0 24 void calculatePosterior();
andrew@0 25 void drawArrays();
andrew@0 26 void drawArraysRelativeToTimeframe(const double& startTimeMillis, const double& endTimeMillis);
andrew@0 27
andrew@0 28 void drawTempoArrays();
andrew@0 29
andrew@0 30 void resetSize(int length);
andrew@0 31 void resetArrays();
andrew@0 32 void simpleExample();
andrew@0 33 void setStartPlaying();
andrew@0 34 void zeroArrays();
andrew@0 35
andrew@0 36 double screenWidth;
andrew@0 37
andrew@0 38 void copyPriorToPosterior();
andrew@0 39 // DynamicBayesianArray bayesArray;
andrew@0 40
andrew@0 41 double lastEventTime;
andrew@0 42 double likelihoodNoise;
andrew@0 43 double speedLikelihoodNoise;
andrew@0 44
andrew@0 45 //DynamicVector tmpPrior;
andrew@0 46 DynamicVector tmpPosteriorForStorage;
andrew@0 47 DynamicVector prior;
andrew@0 48 DynamicVector posterior;
andrew@0 49 DynamicVector likelihood;
andrew@0 50
andrew@0 51 DynamicVector relativeSpeedPrior;
andrew@0 52 DynamicVector relativeSpeedLikelihood;
andrew@0 53 DynamicVector relativeSpeedPosterior;
andrew@0 54 DynamicVector acceleration;
andrew@0 55
andrew@0 56 double tmpBestEstimate;
andrew@0 57 void updateTmpBestEstimate(const double& timeDifference);
andrew@0 58
andrew@0 59 int updateCounter;
andrew@0 60
andrew@0 61 void setPositionDistributionScalar(double f);
andrew@0 62
andrew@0 63 void resetSpeedToOne();
andrew@0 64 void addGaussianNoiseToSpeedPosterior(const double& std_dev);
andrew@0 65 void addTriangularNoiseToSpeedPosterior(const double& std_dev);
andrew@0 66
andrew@0 67 double bestEstimate;
andrew@0 68 void updateBestEstimate(const double& timeDifference);
andrew@0 69 double lastBestEstimateUpdateTime;
andrew@0 70 double speedEstimate, speedEstimateIndex;
andrew@0 71
andrew@0 72 double speedDecayWidth, speedDecayAmount;
andrew@0 73 void decaySpeedDistribution(double timeDifference);
andrew@0 74
andrew@0 75 void resetSpeedSize(int length);
andrew@0 76 void setRelativeSpeedScalar(double f);
andrew@0 77 void setSpeedPrior(double f);
andrew@0 78 void calculateNewPriorOffset(const double& timeDifference);
andrew@0 79 void setNewDistributionOffsets(const double& newOffset);
andrew@0 80
andrew@0 81 void setLikelihoodToConstant();
andrew@0 82 void updateTempoLikelihood(const double& speedRatio, const double& matchFactor);
andrew@0 83 void updateTempoDistribution();
andrew@0 84
andrew@0 85 void calculateTempoUpdate();
andrew@0 86
andrew@0 87 void crossUpdateArrays(DynamicVector& position, DynamicVector& speed, double timeDifference);
andrew@0 88 void complexCrossUpdate(const double& timeDifferenceInPositionVectorUnits);
andrew@0 89 void translateByMaximumSpeed(const double& timeDifferenceInPositionVectorUnits);
andrew@0 90 double crossUpdateTimeThreshold;//time after which we do complex update of multiple speeds
andrew@0 91
andrew@0 92 double speedPriorValue;
andrew@0 93 int priorWidth;
andrew@0 94 bool* realTimeMode;
andrew@0 95 bool usingIntegratedTempoEstimate;
andrew@0 96 double relativeSpeedLikelihoodStdDev;
andrew@0 97
andrew@0 98 };
andrew@0 99 #endif