Mercurial > hg > drum-timing-analyser
changeset 3:303edbbcf1bd tip
updated ofxAubioOnsetDetection file
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Sun, 24 Nov 2013 08:15:17 +0000 |
parents | 50ba55abea8c |
children | |
files | DrumTimingLoader_OF/ofxAubioOnsetDetection/ofxAubioOnsetDetection.cpp |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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