view Source/AubioOnsetDetector.h @ 0:8f67db3c0b01

started repository, works as max object aubioOnsetDetect
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Tue, 18 Oct 2011 01:28:42 +0100
parents
children b4c899822b4e
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;

	
	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;
	
};

#endif