Mercurial > hg > bayesian-drum-tracker
diff newOFsrc/BayesDrumTracker.h @ 2:c49a8f33afab
adding new OF source
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Wed, 22 Feb 2012 22:16:48 +0000 |
parents | |
children | d880f7f29fbe |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/newOFsrc/BayesDrumTracker.h Wed Feb 22 22:16:48 2012 +0000 @@ -0,0 +1,107 @@ +/* + * BayesDrumTracker.h + * bayesianTempoInitialiser5 + * + * Created by Andrew on 14/07/2011. + * Copyright 2011 QMUL. All rights reserved. + * + */ + +#include "ofxOsc.h" +#include "bayesianArray.h" +#include "beatTempo.h" + +class BayesDrumTracker{ + +#ifndef _BAYES_DRUM_TRACKER +#define _BAYES_DRUM_TRACKER +#define ARRAY_SIZE 240 +//#define BAYES_ARRAY_SIZE 240 + + public: + + BayesDrumTracker(); + ~BayesDrumTracker(); + + void initialiseTracker(); + void resetParameters(); + void decayDistributions();//on update + + void setBeatDistribution(int beatPosition); + + void newKickError(const float& error, const double& cpuEventTime, const string& onsetTypeString); + void startTatum(const float& startTatum); + void setNewClickIndex(const int& clickIndex, const float& clickTime); + void sendMaxTempo(); + void sendMaxPhase(); + void newBeat(int& beatIndex); + + void setUniformTempo(); + void setUniformPhase(); + void setBeatNow(const double& beatTime); + void doBeatCorrection(const float& beatCorrFloat); + + + bool filterBeatTime(double newBeatTime); + void crossUpdateArrays(float timeInterval); + bool updateTempoIfWithinRange(double timeInterval); + void calculateTempoUpdate(double tempoInterval); + void updateTempoProcess(const double& cpuTime, const string& onsetDescription); + + + float beatIndexToMsec(const int& index); + float tempoIndexToMsec(const int& index); + + + float kickError, snareError; + double cpuBeatTime; + float testArray[5]; + + double setBeatToNowTime; + + float prior [ARRAY_SIZE]; + float posterior [ARRAY_SIZE]; + float likelihood [ARRAY_SIZE]; + float likelihoodMean, likelihoodStdDev, likelihoodNoise, stepSize; + float maximumEstimate; + float maximumTest, posteriorDecayRate, maximumIndex; + float eighthNoteProportion; + + bool paused; + double maxPhase, maxTempo; + + float tmpArray[ARRAY_SIZE]; + + float correctionFactor; + float beatCorrection; + int correctBeatBy; + + bayesianArray beatDistribution; + bayesianArray tempoDistribution; + double tempoMinimum, tempoMaximum; + double tempoInterval; + beatTempo beatTimes; + + string onsetType; + string timeString; + //double cpuBeatTime; + + ofxOscSender sender; + + double posteriorMaximum; + bool adaptiveStandardDeviationMode; + double tempoStdDev; + bool accompanimentStarted; + bool setDistributionOnStartTempo; + int integerMultipleOfTatum; + + double recentClickTime; + + string kickString;//for info + + float debugArray [4]; + string tempoUpdateStrings[16]; + string tempoDataString; +}; + +#endif \ No newline at end of file