# HG changeset patch # User Andrew N Robertson # Date 1385280917 0 # Node ID 303edbbcf1bde5c7bdca487888c523b650ad5e78 # Parent 50ba55abea8c7382220220f5d55837d7ef31ef9e updated ofxAubioOnsetDetection file diff -r 50ba55abea8c -r 303edbbcf1bd DrumTimingLoader_OF/ofxAubioOnsetDetection/ofxAubioOnsetDetection.cpp --- a/DrumTimingLoader_OF/ofxAubioOnsetDetection/ofxAubioOnsetDetection.cpp Sat Nov 23 15:49:27 2013 +0000 +++ b/DrumTimingLoader_OF/ofxAubioOnsetDetection/ofxAubioOnsetDetection.cpp Sun Nov 24 08:15:17 2013 +0000 @@ -258,12 +258,17 @@ //do highSlopeOnsetRecorded[onsetIndex] = true; - printf("Frame index %i", frameCountIndex); + printf("Frame index %i ", frameCountIndex); int exactOnsetIndex = precisionLocator.findExactOnset(&frame[0], n);//divide by 512.0 or bufferSize to get [0,1] value printf("Exact index %i ", exactOnsetIndex); highSlopeOnsetsFrames.push_back(frameCountIndex); - float exactOffset = -1.0*framesToMillis((float)(n - exactOnsetIndex)/512.0); + + //actually we need to go forwards not back +// float exactOffset = -1.0*framesToMillis((float)(n - exactOnsetIndex)/512.0); - not this + float exactOffset = framesToMillis((float)(exactOnsetIndex)/n); //so counting frames after the beginning of the frame + //since index n will be the start of the n_th frame + float millistime = framesToMillis(frameCountIndex); float finalPreciseTime = millistime + exactOffset;//i.e. with offset due to energy analysis of frame @@ -311,7 +316,6 @@ return ((frameCount*onsetDetector.hopsize*1000.0)/44100.0); } - void ofxAubioOnsetDetection::printOnsetList(){ printf("PRINT ONSET LIST\n"); for (int i = 0;i < chromaOnsets.size();i++){ @@ -321,8 +325,7 @@ printf("PRONT COMPLETE\n"); } - - +#pragma mark -drawRoutines void ofxAubioOnsetDetection::drawOnsetDetection(){ drawOnsetDetection(0, amplitudeNumber, window); @@ -562,6 +565,8 @@ }//end draw pitch lines + +#pragma mark -setParams void ofxAubioOnsetDetection::setDrawParams(){ screenWidth = ofGetWidth(); screenHeight = ofGetHeight();//justin case