annotate src/TempoFollower.h @ 56:4394c9490716 tip

minor changes
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Mon, 24 Dec 2012 18:58:39 +0000
parents 93d21c20cfbc
children
rev   line source
andrew@19 1 /*
andrew@19 2 * TempoFollower.h
andrew@19 3 * MultipleAudioMathcher
andrew@19 4 *
andrew@19 5 * Created by Andrew on 09/02/2012.
andrew@19 6 * Copyright 2012 QMUL. All rights reserved.
andrew@19 7 *
andrew@19 8 */
andrew@19 9
andrew@19 10 #ifndef TEMPO_FOLLOWER_H
andrew@19 11 #define TEMPO_FOLLOWER_H
andrew@19 12
andrew@41 13 #define NUMBER_OF_CHANNELS 4
andrew@19 14
andrew@19 15 #include "ofMain.h"
andrew@19 16 #include "DynamicVector.h"
andrew@19 17 #include "ofxWindowRegion.h"
andrew@20 18 #include "ofxAubioOnsetDetection.h"
andrew@20 19
andrew@20 20 typedef std::vector<double> DoubleVector;
andrew@20 21 typedef std::vector<DoubleVector> DoubleMatrix;
andrew@20 22 typedef std::vector<DoubleMatrix> DoubleCube;
andrew@20 23
andrew@20 24
andrew@20 25 typedef std::vector<int> IntVector;
andrew@20 26 typedef std::vector<IntVector> IntMatrix;
andrew@20 27 typedef std::vector<IntMatrix> IntCube;
andrew@20 28
andrew@20 29 /*
andrew@20 30 struct RecordedTempoData {
andrew@20 31 DoubleCube recordedIntervals;
andrew@20 32 IntCube recordedDivisions;
andrew@20 33 IntMatrix recordedTimes;
andrew@20 34 DoubleMatrix recordedTempo;
andrew@20 35 };
andrew@20 36 */
andrew@19 37
andrew@19 38 class TempoFollower{
andrew@19 39
andrew@19 40 public:
andrew@19 41 TempoFollower();
andrew@19 42
andrew@19 43 DynamicVector tempoPrior;
andrew@19 44 DynamicVector tempoPosterior;
andrew@19 45 DynamicVector tempoLikelihood;
andrew@19 46 int tempoArraySize;
andrew@19 47 int minimumTempoInterval, maximumTempoInterval;
andrew@19 48
andrew@19 49 double playingTempo;
andrew@20 50 void zero();
andrew@19 51 void reset();
andrew@19 52
andrew@19 53 //TEMPO STUFF
andrew@19 54
andrew@20 55
andrew@19 56 DoubleCube tempoIntervals;//channel, event index, vector of interval times
andrew@20 57
andrew@20 58 IntCube divisions;
andrew@19 59
andrew@20 60 IntMatrix eventTimes;
andrew@20 61 DoubleMatrix tempo;
andrew@19 62
andrew@20 63 DoubleVector globalTempo;
andrew@20 64 IntVector globalTempoTimes;
andrew@20 65
andrew@20 66
andrew@19 67 void setUpEventTimeMatrix();
andrew@19 68 void printEventTimes();
andrew@19 69
andrew@19 70 void updateTempo(const int& channel, const int& timeIn);
andrew@19 71 bool testTempoInterval(const int& channel, const double& testTempoInterval, DoubleVector& d);
andrew@19 72 void updateTempoDistribution(const DoubleVector& d);
andrew@19 73 void calculatePosterior();
andrew@19 74 void drawTempoArray(ofxWindowRegion& window);
andrew@19 75
andrew@20 76 double intervalsToTest[4];
andrew@20 77
andrew@20 78 double tempoLikelihoodStdDev;
andrew@20 79
andrew@20 80 void printTempoTimes();//prints global tempo - the playing tempo sequence
andrew@50 81 bool printOutput;
andrew@20 82
andrew@19 83 };
andrew@19 84 #endif