PeakPicking.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  QM DSP Library
5 
6  Centre for Digital Music, Queen Mary, University of London.
7  This file 2005-2006 Christian Landone.
8 
9  Modifications:
10 
11  - delta threshold
12  Description: add delta threshold used as offset in the smoothed
13  detection function
14  Author: Mathieu Barthet
15  Date: June 2010
16 
17  This program is free software; you can redistribute it and/or
18  modify it under the terms of the GNU General Public License as
19  published by the Free Software Foundation; either version 2 of the
20  License, or (at your option) any later version. See the file
21  COPYING included with this distribution for more information.
22 */
23 
24 #ifndef QM_DSP_PEAKPICKING_H
25 #define QM_DSP_PEAKPICKING_H
26 
27 #include "maths/MathUtilities.h"
28 #include "maths/MathAliases.h"
30 
31 
33 {
34  int pre;
35  int post;
36 
37  PPWinThresh(int x, int y) :
38  pre(x),
39  post(y)
40  {
41  }
42 };
43 
44 struct QFitThresh
45 {
46  double a;
47  double b;
48  double c;
49 
50  QFitThresh(double x, double y, double z) :
51  a(x),
52  b(y),
53  c(z)
54  {
55  }
56 };
57 
59 {
60  int length; // detection function length
61  double tau; // time resolution of the detection function
62  int alpha; // alpha-norm parameter
63  double cutoff;// low-pass filter cutoff freq
64  int LPOrd; // low-pass filter order
65  double* LPACoeffs; // low-pass filter denominator coefficients
66  double* LPBCoeffs; // low-pass filter numerator coefficients
67  PPWinThresh WinT;// window size in frames for adaptive thresholding [pre post]:
69  float delta; // delta threshold used as an offset when computing the smoothed detection function
70 
72  length(0),
73  tau(0),
74  alpha(0),
75  cutoff(0),
76  LPOrd(0),
77  LPACoeffs(NULL),
78  LPBCoeffs(NULL),
79  WinT(0,0),
80  QuadThresh(0,0,0),
81  delta(0)
82  {
83  }
84 };
85 
87 {
88 public:
89  PeakPicking( PPickParams Config );
90  virtual ~PeakPicking();
91 
92  void process( double* src, int len, std::vector<int> &onsets );
93 
94 private:
95  void initialise( PPickParams Config );
96  void deInitialise();
97  int quadEval( std::vector<double> &src, std::vector<int> &idx );
98 
100 
102  double Qfilta ;
103  double Qfiltb;
104  double Qfiltc;
105 
106  double* m_workBuffer;
107 
109 };
110 
111 #endif
double * m_workBuffer
Definition: PeakPicking.h:106
DFProcConfig m_DFProcessingParams
Definition: PeakPicking.h:99
double tau
Definition: PeakPicking.h:61
float delta
Definition: PeakPicking.h:69
double * LPBCoeffs
Definition: PeakPicking.h:66
double Qfiltc
Definition: PeakPicking.h:104
double c
Definition: PeakPicking.h:48
DFProcess * m_DFSmoothing
Definition: PeakPicking.h:108
double b
Definition: PeakPicking.h:47
double Qfiltb
Definition: PeakPicking.h:103
double cutoff
Definition: PeakPicking.h:63
double a
Definition: PeakPicking.h:46
PPWinThresh(int x, int y)
Definition: PeakPicking.h:37
double * LPACoeffs
Definition: PeakPicking.h:65
QFitThresh QuadThresh
Definition: PeakPicking.h:68
QFitThresh(double x, double y, double z)
Definition: PeakPicking.h:50
double Qfilta
Definition: PeakPicking.h:102
PPWinThresh WinT
Definition: PeakPicking.h:67