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 // PeakPicking.h: interface for the PeakPicking class.
|
c@225
|
12 //
|
c@225
|
13 //////////////////////////////////////////////////////////////////////
|
c@225
|
14
|
c@225
|
15 #ifndef PEAKPICKING_H
|
c@225
|
16 #define PEAKPICKING_H
|
c@225
|
17
|
c@241
|
18 #include "maths/MathUtilities.h"
|
c@241
|
19 #include "maths/MathAliases.h"
|
c@225
|
20 #include "dsp/signalconditioning/DFProcess.h"
|
c@225
|
21
|
c@225
|
22
|
c@237
|
23 struct PPWinThresh
|
c@225
|
24 {
|
c@225
|
25 unsigned int pre;
|
c@225
|
26 unsigned int post;
|
c@225
|
27 };
|
c@225
|
28
|
c@225
|
29 struct QFitThresh
|
c@225
|
30 {
|
c@225
|
31 double a;
|
c@225
|
32 double b;
|
c@225
|
33 double c;
|
c@225
|
34 };
|
c@225
|
35
|
c@225
|
36 struct PPickParams
|
c@225
|
37 {
|
c@225
|
38 unsigned int length; //Detection FunctionLength
|
c@225
|
39 double tau; // time resolution of the detection function:
|
c@225
|
40 unsigned int alpha; //alpha-norm parameter
|
c@225
|
41 double cutoff;//low-pass Filter cutoff freq
|
c@225
|
42 unsigned int LPOrd; // low-pass Filter order
|
c@225
|
43 double* LPACoeffs; //low pass Filter den coefficients
|
c@225
|
44 double* LPBCoeffs; //low pass Filter num coefficients
|
c@237
|
45 PPWinThresh WinT;//window size in frames for adaptive thresholding [pre post]:
|
c@225
|
46 QFitThresh QuadThresh;
|
c@225
|
47 };
|
c@225
|
48
|
c@225
|
49 class PeakPicking
|
c@225
|
50 {
|
c@225
|
51 public:
|
c@225
|
52 PeakPicking( PPickParams Config );
|
c@225
|
53 virtual ~PeakPicking();
|
c@225
|
54
|
c@225
|
55 void process( double* src, unsigned int len, vector<int> &onsets );
|
c@225
|
56
|
c@225
|
57
|
c@225
|
58 private:
|
c@225
|
59 void initialise( PPickParams Config );
|
c@225
|
60 void deInitialise();
|
c@225
|
61 int quadEval( vector<double> &src, vector<int> &idx );
|
c@225
|
62
|
c@225
|
63 DFProcConfig m_DFProcessingParams;
|
c@225
|
64
|
c@225
|
65 unsigned int m_DFLength ;
|
c@225
|
66 double Qfilta ;
|
c@225
|
67 double Qfiltb;
|
c@225
|
68 double Qfiltc;
|
c@225
|
69
|
c@225
|
70
|
c@225
|
71 double* m_workBuffer;
|
c@225
|
72
|
c@225
|
73 DFProcess* m_DFSmoothing;
|
c@225
|
74 };
|
c@225
|
75
|
c@225
|
76 #endif
|