andrew@0: /* andrew@0: * AudioEventMatcher.h andrew@0: * MultipleAudioMathcher andrew@0: * andrew@0: * Created by Andrew on 31/01/2012. andrew@0: * Copyright 2012 QMUL. All rights reserved. andrew@0: * andrew@0: */ andrew@0: andrew@0: andrew@0: andrew@0: #ifndef AUDIO_EVENT_MATCHER_H andrew@0: #define AUDIO_EVENT_MATCHER_H andrew@0: andrew@0: andrew@0: #include "ofMain.h" andrew@0: #include "ChromaOnset.h" andrew@0: #include "LiveAudioInput.h" andrew@0: #include "ofxWindowRegion.h" andrew@0: #include "BayesianArrayStructure.h" andrew@1: #include "RecordedMultitrackAudio.h" andrew@7: #include "DynamicVector.h" andrew@16: #include "AccompanimentSynchroniser.h" andrew@0: andrew@0: class AudioEventMatcher{ andrew@0: andrew@0: public: andrew@0: AudioEventMatcher(); andrew@0: andrew@0: void setArraySizes(); andrew@0: andrew@9: void updatePosition(); andrew@8: void updateBestAlignmentPosition(); andrew@8: andrew@0: void draw(); andrew@6: void drawBayesianDistributions();; andrew@7: void setWindowDimensions(); andrew@0: andrew@6: void newPitchEvent(const int& channel, const double& pitchIn, const double& timeIn); andrew@2: void newKickEvent(const double& timeIn); andrew@6: void newKickEvent(const int& channel, const double& timeIn); andrew@2: void newSnareEvent(const double& timeIn); andrew@7: void newSnareEvent(const int& channel, const double& timeIn); andrew@2: andrew@2: void matchNewPitchEvent(const int& channel, const double& pitchIn, const double& timeIn); andrew@2: void matchNewOnsetEvent(const int& channel, const double& timeIn); andrew@1: andrew@0: BayesianArrayStructure bayesianStruct;//hold the probability distriubtions andrew@0: andrew@0: LiveAudioInput liveInput;//hold the new events that come in andrew@1: RecordedMultitrackAudio recordedTracks; andrew@1: andrew@16: void loadAudioFiles(); andrew@16: andrew@1: void windowResized(const int& w, const int& h); andrew@0: andrew@0: ofxWindowRegion bayesTempoWindow; andrew@3: ofxWindowRegion bayesPositionWindow; andrew@3: ofxWindowRegion bayesLikelihoodWindow; andrew@0: andrew@3: bool checkMatch(const double& recordedPitch, const double& livePitch); andrew@3: double getPitchDistance(const double& pitchOne, const double& pitchTwo, const double& scale); andrew@3: andrew@3: void startPlaying(); andrew@15: void stopPlaying(); andrew@15: bool startedPlaying; andrew@3: andrew@3: bool usingRealTime; andrew@7: double recentPitch, recentTime; andrew@7: andrew@7: DynamicVector likelihoodVisualisation[3]; andrew@11: DynamicVector recentPriors[3]; andrew@13: //DynamicVector recentPrior; andrew@10: DynamicVector projectedPrior; andrew@8: andrew@8: double currentAlignmentPosition; andrew@8: double lastAlignmentTime; andrew@8: andrew@8: double recentEventTime[3]; andrew@10: int startTime; andrew@11: int currentAlignmentTime; andrew@9: andrew@9: double screenStartTimeMillis, screenEndTimeMillis, screenWidthMillis; andrew@9: bool followingLiveInput; andrew@9: void setScreenDisplayTimes(); andrew@14: andrew@16: AccompanimentSynchroniser synchroniser; andrew@16: andrew@14: //params andrew@14: double onsetLikelihoodWidth; andrew@15: double onsetLikelihoodToNoise; andrew@15: double pitchLikelihoodToNoise;//more noise andrew@0: }; andrew@0: #endif