void AubioOnsetDetector :: postProcessing(){ //anrMedia processed has conditions below anrMedianProcessedOnsetFound = checkForMedianOnset(rawDetectionValue); //the slope idea is we need both a high rise and a high / steep slope and we //look for both of these bestSlopeValue = getBestSlopeValue(rawDetectionValue); anrBestSlopeOnset = checkForSlopeOnset(bestSlopeValue); }
bool AubioOnsetDetector :: processframe(float frame[], int n){ bool newFrameResult = false; //Paul Brossier's aubioonsetclass~ code ported from Pd int j,isonset; for (j=0;j<n;j++) { // write input to datanew fvec_write_sample(vec, frame[j], 0, pos);//vec->data[0][pos] = frame[j] //time for fft if (pos == hopsize-1) { //hopsize is 512 newFrameResult = true; aubioOnsetFound = false; // block loop aubio_pvoc_do (pv,vec, fftgrain); fftgrain->norm[0][0] = fabs(fftgrain->norm[0][0]); //added hack to solve bug that norm[0][0] is negative sometimes. aubio_onsetdetection(o, fftgrain, onset); rawDetectionValue = onset->data[0][0]; //Paul Brossier's method to return value of peak picking process anrMedianProcessedOnsetFound = checkForMedianOnset(rawDetectionValue); bestSlopeValue = getBestSlopeValue(rawDetectionValue); anrBestSlopeOnset = checkForSlopeOnset(bestSlopeValue); // smpl_t my_sample_value; peakPickedDetectionValue = aubio_peakpick_pimrt_getval(parms); //peakPickedDetectionValue = my_sample_value; //this was what got sent from max object:: // outlet_float(x->detectionFunctionOutlet, my_sample_value); // outlet_float(x->rawDetectionFunctionOutlet, x->onset->data[0][0]); isonset = aubio_peakpick_pimrt(onset,parms); if (isonset) { // test for silence if (aubio_silence_detection(vec, -ofGetMouseX())==1) { printf("silence \n"); isonset=0; } else{ // outlet_bang(x->bangoutlet); aubioOnsetFound = true; } }//end if (isonset) // end of block loop pos = -1; // so it will be zero next j loop } pos++; // outL[j] = frame[j];//have added this so signal is "see through": outputting the input signal } //end of Paul's code return newFrameResult; }