annotate src/AudioEventMatcher.h @ 18:4ded82fe318d

added pitch info at top of page
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Tue, 07 Feb 2012 02:37:04 +0000
parents 680ba08e9925
children 1a62561bd72d
rev   line source
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@16 23 #include "AccompanimentSynchroniser.h"
andrew@0 24
andrew@0 25 class AudioEventMatcher{
andrew@0 26
andrew@0 27 public:
andrew@0 28 AudioEventMatcher();
andrew@0 29
andrew@0 30 void setArraySizes();
andrew@0 31
andrew@9 32 void updatePosition();
andrew@8 33 void updateBestAlignmentPosition();
andrew@8 34
andrew@0 35 void draw();
andrew@6 36 void drawBayesianDistributions();;
andrew@7 37 void setWindowDimensions();
andrew@0 38
andrew@6 39 void newPitchEvent(const int& channel, const double& pitchIn, const double& timeIn);
andrew@2 40 void newKickEvent(const double& timeIn);
andrew@6 41 void newKickEvent(const int& channel, const double& timeIn);
andrew@2 42 void newSnareEvent(const double& timeIn);
andrew@7 43 void newSnareEvent(const int& channel, const double& timeIn);
andrew@2 44
andrew@2 45 void matchNewPitchEvent(const int& channel, const double& pitchIn, const double& timeIn);
andrew@2 46 void matchNewOnsetEvent(const int& channel, const double& timeIn);
andrew@1 47
andrew@0 48 BayesianArrayStructure bayesianStruct;//hold the probability distriubtions
andrew@0 49
andrew@0 50 LiveAudioInput liveInput;//hold the new events that come in
andrew@1 51 RecordedMultitrackAudio recordedTracks;
andrew@1 52
andrew@16 53 void loadAudioFiles();
andrew@16 54
andrew@1 55 void windowResized(const int& w, const int& h);
andrew@0 56
andrew@0 57 ofxWindowRegion bayesTempoWindow;
andrew@3 58 ofxWindowRegion bayesPositionWindow;
andrew@3 59 ofxWindowRegion bayesLikelihoodWindow;
andrew@0 60
andrew@3 61 bool checkMatch(const double& recordedPitch, const double& livePitch);
andrew@3 62 double getPitchDistance(const double& pitchOne, const double& pitchTwo, const double& scale);
andrew@3 63
andrew@3 64 void startPlaying();
andrew@15 65 void stopPlaying();
andrew@15 66 bool startedPlaying;
andrew@3 67
andrew@3 68 bool usingRealTime;
andrew@7 69 double recentPitch, recentTime;
andrew@7 70
andrew@7 71 DynamicVector likelihoodVisualisation[3];
andrew@11 72 DynamicVector recentPriors[3];
andrew@13 73 //DynamicVector recentPrior;
andrew@10 74 DynamicVector projectedPrior;
andrew@8 75
andrew@8 76 double currentAlignmentPosition;
andrew@8 77 double lastAlignmentTime;
andrew@8 78
andrew@8 79 double recentEventTime[3];
andrew@10 80 int startTime;
andrew@11 81 int currentAlignmentTime;
andrew@9 82
andrew@9 83 double screenStartTimeMillis, screenEndTimeMillis, screenWidthMillis;
andrew@9 84 bool followingLiveInput;
andrew@9 85 void setScreenDisplayTimes();
andrew@14 86
andrew@16 87 AccompanimentSynchroniser synchroniser;
andrew@16 88
andrew@14 89 //params
andrew@14 90 double onsetLikelihoodWidth;
andrew@15 91 double onsetLikelihoodToNoise;
andrew@15 92 double pitchLikelihoodToNoise;//more noise
andrew@18 93
andrew@18 94 double pitchOfNearestMatch;//for viz purposes
andrew@18 95 double distanceOfNearestMatch;
andrew@0 96 };
andrew@0 97 #endif