Mercurial > hg > multitrack-audio-matcher
view src/AudioEventMatcher.h @ 55:2eca10a31ae2
improving printing of information, looking at how tempo is modelled
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Mon, 10 Dec 2012 17:07:21 +0000 |
parents | 5274e3b5479d |
children | 4394c9490716 |
line wrap: on
line source
/* * AudioEventMatcher.h * MultipleAudioMathcher * * Created by Andrew on 31/01/2012. * Copyright 2012 QMUL. All rights reserved. * */ #ifndef AUDIO_EVENT_MATCHER_H #define AUDIO_EVENT_MATCHER_H #include "ofMain.h" #include "ChromaOnset.h" #include "LiveAudioInput.h" #include "ofxWindowRegion.h" #include "BayesianArrayStructure.h" #include "RecordedMultitrackAudio.h" #include "DynamicVector.h" #include "AccompanimentSynchroniser.h" #include "TempoFollower.h" #include "MatchMarkers.h" #include "OutputDataWriter.h" static const int numberOfChannels = 4; class AudioEventMatcher{ public: AudioEventMatcher(); void setArraySizes(); void updatePosition(); void updateBestAlignmentPosition(); void draw(); void drawBayesianDistributions(); void drawPositionWindow(); void drawTrackLikelihoods(); void drawInfo(); void drawAlignmentTimes(); void drawMarkers(); void setWindowDimensions(); int getScreenWidthIndexOfEventTime(const double& time); int getTimeNow(); void addMarkerNow(); void deleteMarkers(); void deleteNearestMarker(); void moveToNextMarker(); void moveToPreviousMarker(); void goToMarker(const int& markerID); void setToPosition(const double& position);//for Bayesian distbn void setPlaybackPosition(const double& millis); void mousePressed(const int& x); void newPitchEvent(const int& channel, const double& pitchIn, const double& timeIn); void newKickEvent(const double& timeIn); void newKickEvent(const int& channel, const double& timeIn); void newSnareEvent(const double& timeIn); void newSnareEvent(const int& channel, const double& timeIn); void newChromaEvent(const int& channel, float* chromaIn, const double& timeIn); void matchNewPitchEvent(const int& channel, const double& pitchIn, const double& timeIn); void matchNewOnsetEvent(const int& channel, const double& timeIn); void matchNewChromaEvent(const int& channel, float* chroma, const double& timeIn); double getChromaDotProductDistance(float* chromaOne, float* chromaTwo); double getChromaEuclideanDistance(float* chromaOne, float* chromaTwo); bool useChromaDotProduct; float quantisedChromagramReceived[12]; void makeQuantisedChroma(float* chromaIn); BayesianArrayStructure bayesianStruct;//hold the probability distriubtions LiveAudioInput liveInput;//hold the new events that come in RecordedMultitrackAudio recordedTracks; void loadAudioFiles(); void rescue();//flat prior void windowResized(const int& w, const int& h); ofxWindowRegion bayesTempoWindow; ofxWindowRegion bayesPositionWindow; ofxWindowRegion bayesLikelihoodWindow; bool checkMatch(const double& recordedPitch, const double& livePitch); double getPitchDistance(const double& pitchOne, const double& pitchTwo, const double& scale); void startPlaying(); void stopPlaying(); bool startedPlaying; bool usingRealTime; double recentPitch, recentPitchEventTime; DynamicVector likelihoodVisualisation[numberOfChannels]; DynamicVector recentPriors[numberOfChannels]; //DynamicVector recentPrior; DynamicVector projectedPrior; double currentAlignmentPosition; double lastAlignmentTime; double recentEventTime[numberOfChannels]; int startTime; int currentAlignmentTime; double screenStartTimeMillis, screenEndTimeMillis, screenWidthMillis; bool followingLiveInput; void setScreenDisplayTimes(); AccompanimentSynchroniser synchroniser; //params double onsetLikelihoodWidth; double onsetLikelihoodToNoise; double kickLikelihoodToNoise, snareLikelihoodToNoise; double pitchLikelihoodToNoise;//more noise double chromaLikelihoodToNoise; double pitchOfNearestMatch;//for viz purposes double distanceOfNearestMatch; double chromaLikelihoodWidth; TempoFollower temporal; TempoFollower recordedTempoData; void calculateRecordedTempoData(); void setTempoPrior(double tempo); void setNextOnsetTime(const int&channel, int& time, int* indexForOnsets); int recordedTempoIndex; double recordedTempo; void updateRecordedTempo(); void drawRecordedTempo(); double currentSpeedRatio; void drawPlayingTempo(); void setSpeedRatioDistribution(const double& speedRatio); void setNewLimits(const double& position); double euclideanMaximumDistance; bool printingData; bool drawLikelihoods; bool drawPosterior; MatchMarkers markedPoints; double markerPlaybackPosition; OutputDataWriter testDistributionOutput; void writeAllDistributions(); void writeDistribution(DynamicVector& distribution, std::string filename); void writeKickEvent(const int& startMatchingTime, const int& endMatchingTime, std::string filepath); ofImage img; void checkTempo(); double relativeTempo; }; #endif