Mercurial > hg > qm-dsp
comparison dsp/onsets/DetectionFunction.h @ 12:da277e8b5244
* Some fixes to peak picker
* Add broadband energy rise detection function (same as the percussive
onset detector in the Vamp example plugins)
author | cannam |
---|---|
date | Fri, 18 May 2007 16:43:17 +0000 |
parents | c539af5259da |
children | f2b5c4251bf3 |
comparison
equal
deleted
inserted
replaced
11:8837aaa2a0e6 | 12:da277e8b5244 |
---|---|
18 | 18 |
19 #define DF_HFC (1) | 19 #define DF_HFC (1) |
20 #define DF_SPECDIFF (2) | 20 #define DF_SPECDIFF (2) |
21 #define DF_PHASEDEV (3) | 21 #define DF_PHASEDEV (3) |
22 #define DF_COMPLEXSD (4) | 22 #define DF_COMPLEXSD (4) |
23 #define DF_BROADBAND (5) | |
23 | 24 |
24 struct DFConfig{ | 25 struct DFConfig{ |
25 double stepSecs; // DF step in seconds | 26 double stepSecs; // DF step in seconds |
26 unsigned int stepSize; // DF step in samples | 27 unsigned int stepSize; // DF step in samples |
27 unsigned int frameLength; // DF analysis window - usually 2*step | 28 unsigned int frameLength; // DF analysis window - usually 2*step |
28 int DFType; // type of detection function ( see defines ) | 29 int DFType; // type of detection function ( see defines ) |
30 double dbRise; // only used for broadband df (and required for it) | |
29 }; | 31 }; |
30 | 32 |
31 class DetectionFunction | 33 class DetectionFunction |
32 { | 34 { |
33 public: | 35 public: |
42 | 44 |
43 double HFC( unsigned int length, double* src); | 45 double HFC( unsigned int length, double* src); |
44 double specDiff( unsigned int length, double* src); | 46 double specDiff( unsigned int length, double* src); |
45 double phaseDev(unsigned int length, double *srcMagnitude, double *srcPhase); | 47 double phaseDev(unsigned int length, double *srcMagnitude, double *srcPhase); |
46 double complexSD(unsigned int length, double *srcMagnitude, double *srcPhase); | 48 double complexSD(unsigned int length, double *srcMagnitude, double *srcPhase); |
49 double broadband(unsigned int length, double *srcMagnitude, double *srcPhase); | |
47 | 50 |
48 private: | 51 private: |
49 void initialise( DFConfig Config ); | 52 void initialise( DFConfig Config ); |
50 void deInitialise(); | 53 void deInitialise(); |
51 | 54 |
52 int m_DFType; | 55 int m_DFType; |
53 unsigned int m_dataLength; | 56 unsigned int m_dataLength; |
54 unsigned int m_halfLength; | 57 unsigned int m_halfLength; |
58 double m_dbRise; | |
55 | 59 |
56 double* m_magHistory; | 60 double* m_magHistory; |
57 double* m_phaseHistory; | 61 double* m_phaseHistory; |
58 double* m_phaseHistoryOld; | 62 double* m_phaseHistoryOld; |
59 | 63 |