Mercurial > hg > aubio-onset-detector
view Source/AubioOnsetDetector.h @ 3:979125db34ab
added OF visualiser src code. Added a long term median trigger threshold. New method is working very well on onsets
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Mon, 21 Nov 2011 23:22:40 +0000 |
parents | b4c899822b4e |
children |
line wrap: on
line source
#ifndef AUBIOONSETDETECTOR_H #define AUBIOONSETDETECTOR_H #include "aubio.h" class AubioOnsetDetector { public: AubioOnsetDetector(); ~AubioOnsetDetector(); void initialise(); void resetValues(); bool processframe(float frame[], int n); void onsetclass_energy(); void onsetclass_complex(); void onsetclass_specdiff(); void onsetclass_kl(); void onsetclass_mkl(); void onsetclass_hfc(); void onsetclass_phase(); bool checkForMedianOnset(float dfvalue); float getRawDetectionFrame(); float getPeakPickedDetectionFrame(); double framesToSeconds(float frames); // boolean getIsOnset(); aubio_onsetdetection_t *o; aubio_pvoc_t *pv; aubio_pickpeak_t *parms; fvec_t *vec; fvec_t *onset; cvec_t *fftgrain;//complex vector of buffersize, 1 bool aubioOnsetFound;//method used by Paul Brossier //see relevant papers - eg fast transients 2005 int buffersize, hopsize, pos; float threshold, threshold2; float rawDetectionValue, peakPickedDetectionValue; static const int numberOfDetectionValues = 16; float recentRawDetectionValues[numberOfDetectionValues]; int recentValueIndex; float medianDetectionValue, aubioLongTermAverage ; bool anrMedianProcessedOnsetFound;//simple median method by Andrew Robertson //requires a fast rise, slower fall long lastMedianOnsetFrame, currentFrame; float thresholdRelativeToMedian; long cutoffForRepeatOnsetsMillis; float medianSpeed; float lastDfValue; float bestSlopeValue; double getBestSlopeValue(float dfvalue); double bestSlopeMedian; bool anrBestSlopeOnset; long lastSlopeOnsetFrame; bool slopeFallenBelowMedian; bool checkForSlopeOnset(float bestValue); void updateDetectionTriggerThreshold(const float& val); float detectionTriggerThreshold, detectionTriggerRatio; }; #endif