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