view hackday/DynamicBayesianArray.h @ 36:5a1b0c6fa1fb

Added class to read in the csv Annotation file, then write out the respective difference between the performed piece as followed here, and the annotation of RWC by Ewert and Muller
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Thu, 15 Dec 2011 02:28:49 +0000
parents 49a5b023df1e
children
line wrap: on
line source
/*
 *  DynamicBayesianArray.h
 *  midiCannamReader
 *
 *  Created by Andrew on 17/07/2011.
 *  Copyright 2011 QMUL. All rights reserved.
 *
 */

/*
 *  DynamicBayesianArray.cpp
 *  bayesianTest5
 *
 *  Created by Andrew Robertson on 08/05/2010.
 *  Copyright 2010 __MyCompanyName__. All rights reserved.
 *
 */

/*
 *  DynamicBayesianArray.h
 *  bayesianTest5
 *
 *  Created by Andrew Robertson on 08/05/2010.
 *  Copyright 2010 __MyCompanyName__. All rights reserved.
 *
 */

#include "ofMain.h"

#include "DynamicVector.h"

#ifndef	_DYNAMIC_BAYESIAN_ARRAY
#define _DYNAMIC_BAYESIAN_ARRAY

#define ARRAY_SIZE 240


class DynamicBayesianArray{
	
public:
	
	DynamicBayesianArray();
	void initialiseArray();
	
//	void setGaussianLikelihoodForBeats(float mean, float StdDev);		
	void setGaussianLikelihood(float mean, float StdDev);	
	void setGaussianPrior(float mean, float StdDev);
	void setGaussianPosterior(float mean, float StdDev);
	
	void calculatePosterior();
	void renormalisePosterior();
	void resetMaximumPosterior();//resets the max index
	void decayPosteriorWithGaussianNoise();
	void translateDistribution(int translationIndex);
	void setDecayNoiseGaussian(float mean, float StdDev);
	double calculateStandardDeviation();
	
	int arraySize;
	
	
	float getMaximum(float *ptr, int length);
	void renormaliseArray(float *ptr, int length);
	void resetPrior();
	void decayPosterior();
	float* getMaximumEstimate(float *ptr, int length);
	double getMaximumIndex();//return the index where the probability is maximal
	double getIntegratedEstimateIndex();
	
//	void drawArray(const int& minIndex, const int& maxIndex);
	void drawFloatArray(float* arrayToDraw, const int& minIndex, const int& maxIndex);
	void drawDoubleArray(double* arrayToDraw, const int& minIndex, const int& maxIndex);		

	
	typedef std::vector<double> DoubleVector;
//	typedef std::vector<IntVector> DoubleMatrix;
	
	
//	DynamicVector prior;
//	DynamicVector posterior;
//	DynamicVector likelihood;
	
	DynamicVector testVector;	
//	DynamicVector prior;
	
	float prior [ARRAY_SIZE];
	float posterior [ARRAY_SIZE];
	float likelihood [ARRAY_SIZE];	
	float tempPosteriorArray[ARRAY_SIZE];
	
	float decayNoiseArray[ARRAY_SIZE];
	float decayNoiseStdDev, decayNoiseAmount;
	
	float likelihoodMean, likelihoodStdDev, likelihoodNoise;
	float maximumTest, posteriorDecayRate, maximumValue;
	float eighthNoteProportion, earlySixteenthNoteProportion, lateSixteenthNoteProportion ;
	float maximumEstimate, maximumIndex, integratedEstimate;
	double standardDeviation;
	
private:
};

#endif