annotate src/DynamicBayesianArray.h @ 5:195907bb8bb7

added purple where notes have been seen - lets you see what updates have been used. Also the chopping of midi files to the beginning was introduced recently, so when they load, you chop any white space at the beginning, then use first note to launch.
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Fri, 19 Aug 2011 16:38:30 +0100
parents b299a65a3ad0
children c7107e5c8f03
rev   line source
andrew@0 1 /*
andrew@0 2 * DynamicBayesianArray.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
andrew@0 10 /*
andrew@0 11 * DynamicBayesianArray.cpp
andrew@0 12 * bayesianTest5
andrew@0 13 *
andrew@0 14 * Created by Andrew Robertson on 08/05/2010.
andrew@0 15 * Copyright 2010 __MyCompanyName__. All rights reserved.
andrew@0 16 *
andrew@0 17 */
andrew@0 18
andrew@0 19 /*
andrew@0 20 * DynamicBayesianArray.h
andrew@0 21 * bayesianTest5
andrew@0 22 *
andrew@0 23 * Created by Andrew Robertson on 08/05/2010.
andrew@0 24 * Copyright 2010 __MyCompanyName__. All rights reserved.
andrew@0 25 *
andrew@0 26 */
andrew@0 27
andrew@0 28 #include "ofMain.h"
andrew@0 29
andrew@0 30 #include "DynamicVector.h"
andrew@0 31
andrew@0 32 #ifndef _DYNAMIC_BAYESIAN_ARRAY
andrew@0 33 #define _DYNAMIC_BAYESIAN_ARRAY
andrew@0 34
andrew@0 35 #define ARRAY_SIZE 240
andrew@0 36
andrew@0 37
andrew@0 38 class DynamicBayesianArray{
andrew@0 39
andrew@0 40 public:
andrew@0 41
andrew@0 42 DynamicBayesianArray();
andrew@0 43 void initialiseArray();
andrew@0 44
andrew@0 45 // void setGaussianLikelihoodForBeats(float mean, float StdDev);
andrew@0 46 void setGaussianLikelihood(float mean, float StdDev);
andrew@0 47 void setGaussianPrior(float mean, float StdDev);
andrew@0 48 void setGaussianPosterior(float mean, float StdDev);
andrew@0 49
andrew@0 50 void calculatePosterior();
andrew@0 51 void renormalisePosterior();
andrew@0 52 void resetMaximumPosterior();//resets the max index
andrew@0 53 void decayPosteriorWithGaussianNoise();
andrew@0 54 void translateDistribution(int translationIndex);
andrew@0 55 void setDecayNoiseGaussian(float mean, float StdDev);
andrew@0 56 double calculateStandardDeviation();
andrew@0 57
andrew@0 58 int arraySize;
andrew@0 59
andrew@0 60
andrew@0 61 float getMaximum(float *ptr, int length);
andrew@0 62 void renormaliseArray(float *ptr, int length);
andrew@0 63 void resetPrior();
andrew@0 64 void decayPosterior();
andrew@0 65 float* getMaximumEstimate(float *ptr, int length);
andrew@0 66 double getIntegratedEstimateIndex();
andrew@0 67
andrew@0 68 // void drawArray(const int& minIndex, const int& maxIndex);
andrew@0 69 void drawFloatArray(float* arrayToDraw, const int& minIndex, const int& maxIndex);
andrew@0 70 void drawDoubleArray(double* arrayToDraw, const int& minIndex, const int& maxIndex);
andrew@0 71
andrew@0 72
andrew@0 73 typedef std::vector<double> DoubleVector;
andrew@0 74 // typedef std::vector<IntVector> DoubleMatrix;
andrew@0 75
andrew@0 76
andrew@0 77 // DynamicVector prior;
andrew@0 78 // DynamicVector posterior;
andrew@0 79 // DynamicVector likelihood;
andrew@0 80
andrew@0 81 DynamicVector testVector;
andrew@0 82 // DynamicVector prior;
andrew@0 83
andrew@0 84 float prior [ARRAY_SIZE];
andrew@0 85 float posterior [ARRAY_SIZE];
andrew@0 86 float likelihood [ARRAY_SIZE];
andrew@0 87 float tempPosteriorArray[ARRAY_SIZE];
andrew@0 88
andrew@0 89 float decayNoiseArray[ARRAY_SIZE];
andrew@0 90 float decayNoiseStdDev, decayNoiseAmount;
andrew@0 91
andrew@0 92 float likelihoodMean, likelihoodStdDev, likelihoodNoise;
andrew@0 93 float maximumTest, posteriorDecayRate, maximumValue;
andrew@0 94 float eighthNoteProportion, earlySixteenthNoteProportion, lateSixteenthNoteProportion ;
andrew@0 95 float maximumEstimate, maximumIndex, integratedEstimate;
andrew@0 96 double standardDeviation;
andrew@0 97
andrew@0 98 private:
andrew@0 99 };
andrew@0 100
andrew@0 101 #endif
andrew@0 102
andrew@0 103
andrew@0 104