andrew@0: /* andrew@0: * PeakProcessor.h andrew@0: * peakOnsetDetector andrew@0: * andrew@2: * Created by Andrew Robertson on 07/09/2012. andrew@0: * Copyright 2012 QMUL. All rights reserved. andrew@0: * andrew@0: */ andrew@0: andrew@0: #ifndef PEAK_PROCESSOR andrew@0: #define PEAK_PROCESSOR andrew@0: andrew@0: #include andrew@1: #include "math.h" andrew@0: andrew@0: class PeakProcessor{ andrew@0: public: andrew@0: andrew@0: PeakProcessor(); andrew@0: ~PeakProcessor(); Venetian@8: Venetian@8: void initialise(); Venetian@8: void reset(); Venetian@8: andrew@0: //peak processing requires andrew@0: static const int vectorSize = 512/6; andrew@0: vector recentDFsamples; andrew@0: vector recentDFonsetFound; andrew@0: vector recentDFslopeValues; andrew@0: andrew@0: int numberOfDetectionValuesToTest; andrew@0: bool peakProcessing(const double& newDFval); andrew@0: double getBestSlopeValue(const float& dfvalue); andrew@0: bool checkForSlopeOnset(const float& bestValue); andrew@0: int currentFrame, lastSlopeOnsetFrame, cutoffForRepeatOnsetsFrames; andrew@0: void updateDetectionTriggerThreshold(const float& val); andrew@0: float detectionTriggerThreshold, detectionTriggerRatio; andrew@0: float bestSlopeMedian, thresholdRelativeToMedian; andrew@0: bool newOnsetFound, slopeFallenBelowMedian; andrew@0: Venetian@8: float minimumThreshold; andrew@0: andrew@0: }; andrew@0: #endif