Mercurial > hg > midi-score-follower
changeset 51:ef30f465a904
some minor code changes to choose midi or audio match alignment
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Sat, 31 Mar 2012 14:04:49 +0100 |
parents | 158f5f38e9d3 |
children | 13194a9dca77 |
files | .DS_Store matchAnnotationSrc/testApp.cpp matchAnnotationSrc/testApp.h |
diffstat | 3 files changed, 101 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/matchAnnotationSrc/testApp.cpp Thu Mar 29 13:41:59 2012 +0100 +++ b/matchAnnotationSrc/testApp.cpp Sat Mar 31 14:04:49 2012 +0100 @@ -1,16 +1,89 @@ #include "testApp.h" - +const int totalNumberFiles = 61; //-------------------------------------------------------------- void testApp::setup(){ //fixed stuff annotationRoot = "/Users/andrew/Documents/work/Alignment/MuseScore/RWC/ANNOTATION/RM-C0"; jnmrPlayerRoot = "/Users/andrew/Documents/work/programming/of_preRelease_v007_osx/apps/myOpenFrameworks007/JNMR_MidiFollower/bin/data/FilesOut/completeTestsTempoMAPestimate/rwcOutputData_RM-C0"; - +// matchRoot = "/Users/andrew/Documents/work/programming/Shell Scripts/MatchAudioToMidiOutput/RWCmatch_RM-C";//ACTUAL AUDIO VERSION OF WARPED + matchRoot = "/Users/andrew/Documents/work/programming/Shell Scripts/MatchMidiToMidiOutput/RWCmatch_RM-C";//MIDI VERSION OF WARPED + createRWCfilenameStrings(); - fileNumberToTest = 0; - loadAnnotation(fileNumberToTest); - getResults(fileNumberToTest); + fileNumberToTest = 0; + + while (fileNumberToTest < totalNumberFiles){ + loadAnnotation(fileNumberToTest); + getResults(fileNumberToTest); + fileNumberToTest++; + } + calculateOverallPercentiles(); + calculateOverallMatchPercentiles(); +} + +void testApp::calculateOverallPercentiles(){ + + int numberToCount = 61;//totalNumberFiles; + printf("\nFINAL PERCENTILES for %i files\n", numberToCount); + final_JNMR_Midi.count = 0; + for (int i =0;i < numberToCount;i++){ + for (int k = 0;k < 7;k++){ + final_JNMR_Midi.percentileCount[k] += JNMR_MidiMatcher_results[i].percentileCount[k]; + //printf("file %i, precentile count[%i] is %f\n", i, k, JNMR_MidiMatcher_results[i].percentileCount[k]); + } + final_JNMR_Midi.count += JNMR_MidiMatcher_results[i].count; + } + + for (int p = 0;p < 7;p++){ + final_JNMR_Midi.percentiles[p] = final_JNMR_Midi.percentileCount[p] / final_JNMR_Midi.count; + printf("final JNMR percentile [%i] = %.2f, count %i, perc count %.1f\n", p, final_JNMR_Midi.percentiles[p]*100.0, final_JNMR_Midi.count, final_JNMR_Midi.percentileCount[p]); + + + } + + for (int i = 0;i < 7;i++){ + printf("%.1f &", final_JNMR_Midi.percentiles[i]*100.0); + } +} + + +void testApp::calculateOverallMatchPercentiles(){ + + int numberToCount = 61;//totalNumberFiles; + printf("\n FINAL MATCH FORWARDS PERCENTILES for %i files\n", numberToCount); + final_Match_OF.count = 0; + final_Match_OB.count = 0; + + for (int i =0;i < numberToCount;i++){ + for (int k = 0;k < 7;k++){ + final_Match_OF.percentileCount[k] += matchOF_results[i].percentileCount[k]; + final_Match_OB.percentileCount[k] += matchOB_results[i].percentileCount[k]; + } + final_Match_OF.count += matchOF_results[i].count; + final_Match_OB.count += matchOB_results[i].count; + } + + for (int p = 0;p < 7;p++){ + + final_Match_OF.percentiles[p] = final_Match_OF.percentileCount[p] / final_Match_OF.count; + final_Match_OB.percentiles[p] = final_Match_OB.percentileCount[p] / final_Match_OB.count; + + printf("final Match_OF percentile [%i] = %.2f, count %i, perc count %.1f\n", p, final_Match_OF.percentiles[p]*100., + final_Match_OF.count, final_Match_OF.percentileCount[p]); + } + printf("\n FINAL MATCH BACKWARDS PERCENTILES for %i files\n", numberToCount); + for (int p = 0;p < 7;p++){ + printf("final Match_OB percentile [%i] = %.2f, count %i, perc count %.1f\n", p, final_Match_OB.percentiles[p]*100., + final_Match_OB.count, final_Match_OB.percentileCount[p]); + } + printf("\nOB: "); + for (int i = 0;i < 7;i++){ + printf("%.1f &", final_Match_OB.percentiles[i]*100.0); + } + printf("\nOF: "); + for (int i = 0;i < 7;i++){ + printf("%.1f &", final_Match_OF.percentiles[i]*100.0); + } } void testApp::getResults(const int& fileID){ @@ -50,8 +123,6 @@ std::string testApp::makeMatchFilename( const int& fileID, std::string matchEnd){ - std::string matchRoot = "/Users/andrew/Documents/work/programming/Shell Scripts/completeMatchOut/RWCmatch_RM-C"; - string rootToUse = matchRoot; if (fileID > 8){
--- a/matchAnnotationSrc/testApp.h Thu Mar 29 13:41:59 2012 +0100 +++ b/matchAnnotationSrc/testApp.h Sat Mar 31 14:04:49 2012 +0100 @@ -6,15 +6,29 @@ #include "matchAnnotations.h" #include "jnmrMidiPlayerAnnotations.h" -struct TimingResult{ +class TimingResult{ +public: + double median; double mean; int count; double percentileCount[7]; double percentiles[7]; int type; + + TimingResult(){ + median= 0; + mean = 0; + count = 0; + for (int i = 0;i <7;i++){ + percentileCount[i] = 0; + percentiles[i] = 0; + } + } }; + + class testApp : public ofBaseApp{ public: @@ -59,6 +73,14 @@ vector<TimingResult> matchOB_results; vector<TimingResult> JNMR_MidiMatcher_results; + TimingResult final_JNMR_Midi; + TimingResult final_Match_OF; + TimingResult final_Match_OB; + + + std::string matchRoot;// = "/Users/andrew/Documents/work/programming/Shell Scripts/MatchMidiToMidiOutput/RWCmatch_RM-C"; void getResults(const int& fileID); + void calculateOverallPercentiles(); + void calculateOverallMatchPercentiles(); int fileNumberToTest; };