annotate Source/AubioOnsetDetector.h @ 6:6a95d8b80393 tip

unknown changes
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Mon, 26 Nov 2012 23:17:34 +0000
parents 979125db34ab
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(float frame[], int n);
andrew@0 16 void onsetclass_energy();
andrew@0 17 void onsetclass_complex();
andrew@0 18 void onsetclass_specdiff();
andrew@0 19 void onsetclass_kl();
andrew@0 20 void onsetclass_mkl();
andrew@0 21 void onsetclass_hfc();
andrew@0 22 void onsetclass_phase();
andrew@0 23
andrew@0 24 bool checkForMedianOnset(float dfvalue);
andrew@0 25
andrew@0 26 float getRawDetectionFrame();
andrew@0 27 float getPeakPickedDetectionFrame();
andrew@0 28 double framesToSeconds(float frames);
andrew@0 29 // boolean getIsOnset();
andrew@0 30
andrew@0 31
andrew@0 32 aubio_onsetdetection_t *o;
andrew@0 33 aubio_pvoc_t *pv;
andrew@0 34 aubio_pickpeak_t *parms;
andrew@0 35
andrew@0 36
andrew@0 37 fvec_t *vec;
andrew@0 38 fvec_t *onset;
andrew@0 39 cvec_t *fftgrain;//complex vector of buffersize, 1
andrew@0 40
andrew@0 41 bool aubioOnsetFound;//method used by Paul Brossier
andrew@0 42 //see relevant papers - eg fast transients 2005
andrew@0 43 int buffersize, hopsize, pos;
andrew@0 44 float threshold, threshold2;
andrew@0 45 float rawDetectionValue, peakPickedDetectionValue;
andrew@0 46
andrew@2 47 static const int numberOfDetectionValues = 16;
andrew@2 48 float recentRawDetectionValues[numberOfDetectionValues];
andrew@2 49 int recentValueIndex;
andrew@0 50
andrew@0 51 float medianDetectionValue, aubioLongTermAverage ;
andrew@0 52 bool anrMedianProcessedOnsetFound;//simple median method by Andrew Robertson
andrew@0 53 //requires a fast rise, slower fall
andrew@0 54 long lastMedianOnsetFrame, currentFrame;
andrew@0 55 float thresholdRelativeToMedian;
andrew@0 56 long cutoffForRepeatOnsetsMillis;
andrew@0 57 float medianSpeed;
andrew@2 58 float lastDfValue;
andrew@2 59 float bestSlopeValue;
andrew@2 60 double getBestSlopeValue(float dfvalue);
andrew@2 61 double bestSlopeMedian;
andrew@2 62 bool anrBestSlopeOnset;
andrew@2 63 long lastSlopeOnsetFrame;
andrew@2 64 bool slopeFallenBelowMedian;
andrew@2 65 bool checkForSlopeOnset(float bestValue);
andrew@0 66
andrew@3 67 void updateDetectionTriggerThreshold(const float& val);
andrew@3 68
andrew@3 69 float detectionTriggerThreshold, detectionTriggerRatio;
andrew@3 70
andrew@0 71 };
andrew@0 72
andrew@0 73 #endif