annotate src/BayesDrumTracker.h @ 12:e148d1534733 tip

adding new max player
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Fri, 09 Mar 2012 20:42:34 +0000
parents 0f9165f96bdb
children
rev   line source
andrew@0 1 /*
andrew@0 2 * BayesDrumTracker.h
andrew@0 3 * bayesianTempoInitialiser5
andrew@0 4 *
andrew@0 5 * Created by Andrew on 14/07/2011.
andrew@0 6 * Copyright 2011 QMUL. All rights reserved.
andrew@0 7 *
andrew@0 8 */
andrew@0 9
andrew@0 10 #include "ofxOsc.h"
andrew@0 11 #include "bayesianArray.h"
andrew@0 12 #include "beatTempo.h"
andrew@0 13
andrew@0 14 class BayesDrumTracker{
andrew@0 15
andrew@0 16 #ifndef _BAYES_DRUM_TRACKER
andrew@0 17 #define _BAYES_DRUM_TRACKER
andrew@0 18 #define ARRAY_SIZE 240
andrew@0 19 //#define BAYES_ARRAY_SIZE 240
andrew@0 20
andrew@0 21 public:
andrew@0 22
andrew@0 23 BayesDrumTracker();
andrew@0 24 ~BayesDrumTracker();
andrew@0 25
andrew@0 26 void initialiseTracker();
andrew@0 27 void resetParameters();
andrew@0 28 void decayDistributions();//on update
andrew@0 29
andrew@0 30 void setBeatDistribution(int beatPosition);
andrew@0 31
andrew@0 32 void newKickError(const float& error, const double& cpuEventTime, const string& onsetTypeString);
andrew@0 33 void startTatum(const float& startTatum);
andrew@0 34 void setNewClickIndex(const int& clickIndex, const float& clickTime);
andrew@0 35 void sendMaxTempo();
andrew@0 36 void sendMaxPhase();
andrew@0 37 void newBeat(int& beatIndex);
andrew@0 38
andrew@0 39 void setUniformTempo();
andrew@0 40 void setUniformPhase();
andrew@0 41 void setBeatNow(const double& beatTime);
andrew@0 42 void doBeatCorrection(const float& beatCorrFloat);
andrew@0 43
andrew@0 44
andrew@0 45 bool filterBeatTime(double newBeatTime);
andrew@0 46 void crossUpdateArrays(float timeInterval);
andrew@0 47 bool updateTempoIfWithinRange(double timeInterval);
andrew@0 48 void calculateTempoUpdate(double tempoInterval);
andrew@0 49 void updateTempoProcess(const double& cpuTime, const string& onsetDescription);
andrew@0 50
andrew@0 51
andrew@0 52 float beatIndexToMsec(const int& index);
andrew@0 53 float tempoIndexToMsec(const int& index);
andrew@0 54
andrew@0 55
andrew@0 56 float kickError, snareError;
andrew@0 57 double cpuBeatTime;
andrew@0 58 float testArray[5];
andrew@0 59
andrew@0 60 double setBeatToNowTime;
andrew@0 61
andrew@0 62 float prior [ARRAY_SIZE];
andrew@0 63 float posterior [ARRAY_SIZE];
andrew@0 64 float likelihood [ARRAY_SIZE];
andrew@0 65 float likelihoodMean, likelihoodStdDev, likelihoodNoise, stepSize;
andrew@0 66 float maximumEstimate;
andrew@0 67 float maximumTest, posteriorDecayRate, maximumIndex;
andrew@0 68 float eighthNoteProportion;
andrew@0 69
andrew@0 70 bool paused;
andrew@0 71 double maxPhase, maxTempo;
andrew@0 72
andrew@0 73 float tmpArray[ARRAY_SIZE];
andrew@0 74
andrew@0 75 float correctionFactor;
andrew@0 76 float beatCorrection;
andrew@0 77 int correctBeatBy;
andrew@0 78
andrew@0 79 bayesianArray beatDistribution;
andrew@0 80 bayesianArray tempoDistribution;
andrew@0 81 double tempoMinimum, tempoMaximum;
andrew@0 82 double tempoInterval;
andrew@0 83 beatTempo beatTimes;
andrew@0 84
andrew@0 85 string onsetType;
andrew@0 86 string timeString;
andrew@0 87 //double cpuBeatTime;
andrew@0 88
andrew@0 89 ofxOscSender sender;
andrew@0 90
andrew@0 91 double posteriorMaximum;
andrew@0 92 bool adaptiveStandardDeviationMode;
andrew@0 93 double tempoStdDev;
andrew@0 94 bool accompanimentStarted;
andrew@0 95 bool setDistributionOnStartTempo;
andrew@0 96 int integerMultipleOfTatum;
andrew@0 97
andrew@0 98 double recentClickTime;
andrew@0 99
andrew@0 100 string kickString;//for info
andrew@0 101
andrew@0 102 float debugArray [4];
andrew@0 103 string tempoUpdateStrings[16];
andrew@0 104 string tempoDataString;
andrew@0 105 };
andrew@0 106
andrew@0 107 #endif