andrew@0
|
1 /*
|
andrew@0
|
2 * AudioEventMatcher.h
|
andrew@0
|
3 * MultipleAudioMathcher
|
andrew@0
|
4 *
|
andrew@0
|
5 * Created by Andrew on 31/01/2012.
|
andrew@0
|
6 * Copyright 2012 QMUL. All rights reserved.
|
andrew@0
|
7 *
|
andrew@0
|
8 */
|
andrew@0
|
9
|
andrew@0
|
10
|
andrew@0
|
11
|
andrew@0
|
12 #ifndef AUDIO_EVENT_MATCHER_H
|
andrew@0
|
13 #define AUDIO_EVENT_MATCHER_H
|
andrew@0
|
14
|
andrew@0
|
15
|
andrew@0
|
16 #include "ofMain.h"
|
andrew@0
|
17 #include "ChromaOnset.h"
|
andrew@0
|
18 #include "LiveAudioInput.h"
|
andrew@0
|
19 #include "ofxWindowRegion.h"
|
andrew@0
|
20 #include "BayesianArrayStructure.h"
|
andrew@1
|
21 #include "RecordedMultitrackAudio.h"
|
andrew@7
|
22 #include "DynamicVector.h"
|
andrew@0
|
23
|
andrew@0
|
24 class AudioEventMatcher{
|
andrew@0
|
25
|
andrew@0
|
26 public:
|
andrew@0
|
27 AudioEventMatcher();
|
andrew@0
|
28
|
andrew@0
|
29 void setArraySizes();
|
andrew@0
|
30
|
andrew@0
|
31 void draw();
|
andrew@6
|
32 void drawBayesianDistributions();;
|
andrew@7
|
33 void setWindowDimensions();
|
andrew@0
|
34
|
andrew@6
|
35 void newPitchEvent(const int& channel, const double& pitchIn, const double& timeIn);
|
andrew@2
|
36 void newKickEvent(const double& timeIn);
|
andrew@6
|
37 void newKickEvent(const int& channel, const double& timeIn);
|
andrew@2
|
38 void newSnareEvent(const double& timeIn);
|
andrew@7
|
39 void newSnareEvent(const int& channel, const double& timeIn);
|
andrew@2
|
40
|
andrew@2
|
41 void matchNewPitchEvent(const int& channel, const double& pitchIn, const double& timeIn);
|
andrew@2
|
42 void matchNewOnsetEvent(const int& channel, const double& timeIn);
|
andrew@1
|
43
|
andrew@0
|
44 BayesianArrayStructure bayesianStruct;//hold the probability distriubtions
|
andrew@0
|
45
|
andrew@0
|
46 LiveAudioInput liveInput;//hold the new events that come in
|
andrew@1
|
47 RecordedMultitrackAudio recordedTracks;
|
andrew@1
|
48
|
andrew@1
|
49 void windowResized(const int& w, const int& h);
|
andrew@0
|
50
|
andrew@0
|
51 ofxWindowRegion bayesTempoWindow;
|
andrew@3
|
52 ofxWindowRegion bayesPositionWindow;
|
andrew@3
|
53 ofxWindowRegion bayesLikelihoodWindow;
|
andrew@0
|
54
|
andrew@3
|
55 bool checkMatch(const double& recordedPitch, const double& livePitch);
|
andrew@3
|
56 double getPitchDistance(const double& pitchOne, const double& pitchTwo, const double& scale);
|
andrew@3
|
57
|
andrew@3
|
58 void startPlaying();
|
andrew@3
|
59
|
andrew@3
|
60 bool usingRealTime;
|
andrew@7
|
61 double recentPitch, recentTime;
|
andrew@7
|
62
|
andrew@7
|
63 DynamicVector likelihoodVisualisation[3];
|
andrew@7
|
64 DynamicVector recentPrior;
|
andrew@6
|
65
|
andrew@0
|
66 };
|
andrew@0
|
67 #endif
|