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@309
|
7 This file 2005-2006 Christian Landone.
|
c@309
|
8
|
c@309
|
9 This program is free software; you can redistribute it and/or
|
c@309
|
10 modify it under the terms of the GNU General Public License as
|
c@309
|
11 published by the Free Software Foundation; either version 2 of the
|
c@309
|
12 License, or (at your option) any later version. See the file
|
c@309
|
13 COPYING included with this distribution for more information.
|
c@225
|
14 */
|
c@225
|
15
|
c@225
|
16 // PeakPicking.h: interface for the PeakPicking class.
|
c@225
|
17 //
|
c@225
|
18 //////////////////////////////////////////////////////////////////////
|
c@225
|
19
|
c@225
|
20 #ifndef PEAKPICKING_H
|
c@225
|
21 #define PEAKPICKING_H
|
c@225
|
22
|
c@241
|
23 #include "maths/MathUtilities.h"
|
c@241
|
24 #include "maths/MathAliases.h"
|
c@225
|
25 #include "dsp/signalconditioning/DFProcess.h"
|
c@225
|
26
|
c@225
|
27
|
c@237
|
28 struct PPWinThresh
|
c@225
|
29 {
|
c@225
|
30 unsigned int pre;
|
c@225
|
31 unsigned int post;
|
c@225
|
32 };
|
c@225
|
33
|
c@225
|
34 struct QFitThresh
|
c@225
|
35 {
|
c@225
|
36 double a;
|
c@225
|
37 double b;
|
c@225
|
38 double c;
|
c@225
|
39 };
|
c@225
|
40
|
c@225
|
41 struct PPickParams
|
c@225
|
42 {
|
c@225
|
43 unsigned int length; //Detection FunctionLength
|
c@225
|
44 double tau; // time resolution of the detection function:
|
c@225
|
45 unsigned int alpha; //alpha-norm parameter
|
c@225
|
46 double cutoff;//low-pass Filter cutoff freq
|
c@225
|
47 unsigned int LPOrd; // low-pass Filter order
|
c@225
|
48 double* LPACoeffs; //low pass Filter den coefficients
|
c@225
|
49 double* LPBCoeffs; //low pass Filter num coefficients
|
c@237
|
50 PPWinThresh WinT;//window size in frames for adaptive thresholding [pre post]:
|
c@225
|
51 QFitThresh QuadThresh;
|
c@225
|
52 };
|
c@225
|
53
|
c@225
|
54 class PeakPicking
|
c@225
|
55 {
|
c@225
|
56 public:
|
c@225
|
57 PeakPicking( PPickParams Config );
|
c@225
|
58 virtual ~PeakPicking();
|
c@225
|
59
|
c@225
|
60 void process( double* src, unsigned int len, vector<int> &onsets );
|
c@225
|
61
|
c@225
|
62
|
c@225
|
63 private:
|
c@225
|
64 void initialise( PPickParams Config );
|
c@225
|
65 void deInitialise();
|
c@225
|
66 int quadEval( vector<double> &src, vector<int> &idx );
|
c@225
|
67
|
c@225
|
68 DFProcConfig m_DFProcessingParams;
|
c@225
|
69
|
c@225
|
70 unsigned int m_DFLength ;
|
c@225
|
71 double Qfilta ;
|
c@225
|
72 double Qfiltb;
|
c@225
|
73 double Qfiltc;
|
c@225
|
74
|
c@225
|
75
|
c@225
|
76 double* m_workBuffer;
|
c@225
|
77
|
c@225
|
78 DFProcess* m_DFSmoothing;
|
c@225
|
79 };
|
c@225
|
80
|
c@225
|
81 #endif
|