annotate DrumTimingLoader_OF/ofxAubioOnsetDetection/AubioOnsetDetector.h @ 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 82352cfc0b23
children
rev   line source
andrew@0 1
andrew@0 2 #ifndef AUBIOONSETDETECTOR_H
andrew@0 3 #define AUBIOONSETDETECTOR_H
andrew@0 4
andrew@0 5 #include "aubio.h"
andrew@0 6
andrew@0 7 class AubioOnsetDetector
andrew@0 8 {
andrew@0 9 public:
andrew@0 10 AubioOnsetDetector();
andrew@0 11 ~AubioOnsetDetector();
andrew@0 12 void initialise();
andrew@0 13 void resetValues();
andrew@0 14
andrew@0 15 bool processframe(double* frame, const int& n);
andrew@0 16 bool processframe(float* frame, const int& n);
andrew@0 17
andrew@0 18 void onsetclass_energy();
andrew@0 19 void onsetclass_complex();
andrew@0 20 void onsetclass_specdiff();
andrew@0 21 void onsetclass_kl();
andrew@0 22 void onsetclass_mkl();
andrew@0 23 void onsetclass_hfc();
andrew@0 24 void onsetclass_phase();
andrew@0 25
andrew@0 26 bool checkForMedianOnset(const float& dfvalue);
andrew@0 27 void postProcessing();
andrew@0 28
andrew@0 29 float getRawDetectionFrame();
andrew@0 30 float getPeakPickedDetectionFrame();
andrew@0 31 double framesToSeconds(const float& frames);
andrew@0 32 // double framesToMillis(const float& frames);
andrew@0 33 // boolean getIsOnset();
andrew@0 34
andrew@0 35
andrew@0 36 aubio_onsetdetection_t *o;
andrew@0 37 aubio_pvoc_t *pv;
andrew@0 38 aubio_pickpeak_t *parms;
andrew@0 39
andrew@0 40
andrew@0 41 fvec_t *vec;
andrew@0 42 fvec_t *onset;
andrew@0 43 cvec_t *fftgrain;//complex vector of buffersize, 1
andrew@0 44
andrew@0 45 bool aubioOnsetFound;//method used by Paul Brossier
andrew@0 46 //see relevant papers - eg fast transients 2005
andrew@0 47 int buffersize, hopsize, pos;
andrew@0 48 float threshold, threshold2;
andrew@0 49 float rawDetectionValue, peakPickedDetectionValue;
andrew@0 50
andrew@0 51 static const int numberOfDetectionValues = 16;
andrew@0 52 float recentRawDetectionValues[numberOfDetectionValues];
andrew@0 53
andrew@0 54 int recentValueIndex;
andrew@0 55
andrew@0 56 float medianDetectionValue, aubioLongTermAverage ;
andrew@0 57 bool anrMedianProcessedOnsetFound;//simple median method by Andrew Robertson
andrew@0 58 //requires a fast rise, slower fall
andrew@0 59 long lastMedianOnsetFrame, currentFrame;
andrew@0 60 float thresholdRelativeToMedian;
andrew@0 61 long cutoffForRepeatOnsetsMillis;
andrew@0 62 float medianSpeed;
andrew@0 63 float lastDfValue;
andrew@0 64 float bestSlopeValue;
andrew@0 65 double getBestSlopeValue(const float& dfvalue);
andrew@0 66 double bestSlopeMedian;
andrew@0 67 bool anrBestSlopeOnset;
andrew@0 68 long lastSlopeOnsetFrame;
andrew@0 69 bool slopeFallenBelowMedian;
andrew@0 70 bool checkForSlopeOnset(const float& bestValue);
andrew@0 71
andrew@0 72 void updateDetectionTriggerThreshold(const float& val);
andrew@0 73
andrew@0 74 float detectionTriggerThreshold, detectionTriggerRatio;
andrew@0 75 float maximumDetectionValue;
andrew@0 76
andrew@0 77
andrew@0 78 };
andrew@0 79
andrew@0 80 #endif