annotate dsp/onsets/DetectionFunction.h @ 225:49844bc8a895

* Queen Mary C++ DSP library
author Chris Cannam <c.cannam@qmul.ac.uk>
date Wed, 05 Apr 2006 17:35:59 +0000
parents
children c539af5259da
rev   line source
c@225 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
c@225 2
c@225 3 /*
c@225 4 QM DSP Library
c@225 5
c@225 6 Centre for Digital Music, Queen Mary, University of London.
c@225 7 This file copyright 2005-2006 Christian Landone.
c@225 8 All rights reserved.
c@225 9 */
c@225 10
c@225 11 #ifndef DETECTIONFUNCTION_H
c@225 12 #define DETECTIONFUNCTION_H
c@225 13
c@225 14 #include "dsp/maths/MathUtilities.h"
c@225 15 #include "dsp/maths/MathAliases.h"
c@225 16 #include "dsp/phasevocoder/PhaseVocoder.h"
c@225 17 #include "base/Window.h"
c@225 18
c@225 19 #define DF_HFC (1)
c@225 20 #define DF_SPECDIFF (2)
c@225 21 #define DF_PHASEDEV (3)
c@225 22 #define DF_COMPLEXSD (4)
c@225 23
c@225 24 struct DFConfig{
c@225 25 double stepSecs; // DF step in seconds
c@225 26 unsigned int stepSize; // DF step in samples
c@225 27 unsigned int frameLength; // DF analysis window - usually 2*step
c@225 28 int DFType; // type of detection function ( see defines )
c@225 29 };
c@225 30
c@225 31 class DetectionFunction
c@225 32 {
c@225 33 public:
c@225 34 double* getSpectrumMagnitude();
c@225 35 DetectionFunction( DFConfig Config );
c@225 36 virtual ~DetectionFunction();
c@225 37 double process( double* TDomain );
c@225 38
c@225 39 private:
c@225 40 double HFC( unsigned int length, double* src);
c@225 41 double specDiff( unsigned int length, double* src);
c@225 42 double phaseDev(unsigned int length, double *srcMagnitude, double *srcPhase);
c@225 43 double complexSD(unsigned int length, double *srcMagnitude, double *srcPhase);
c@225 44
c@225 45 private:
c@225 46 void initialise( DFConfig Config );
c@225 47 void deInitialise();
c@225 48
c@225 49 int m_DFType;
c@225 50 unsigned int m_dataLength;
c@225 51 unsigned int m_halfLength;
c@225 52
c@225 53 double* magHistory;
c@225 54 double* phaseHistory;
c@225 55 double* phaseHistoryOld;
c@225 56
c@225 57 double* m_DFWindowedFrame; // Array for windowed analysis frame
c@225 58 double* m_magnitude; // Magnitude of analysis frame ( frequency domain )
c@225 59 double* m_thetaAngle;// Phase of analysis frame ( frequency domain )
c@225 60
c@225 61
c@225 62 vector < ComplexData > meas ;
c@225 63
c@225 64 ComplexData j;
c@225 65
c@225 66 Window<double> *m_window;
c@225 67
c@225 68 PhaseVocoder* m_phaseVoc; // Phase Vocoder
c@225 69
c@225 70 };
c@225 71
c@225 72 #endif