annotate dsp/onsets/PeakPicking.h @ 92:c313a173f4a9

* Sort out this isnan/isinf nonsense once and for all
author Chris Cannam
date Wed, 09 Feb 2011 15:25:36 +0000
parents e5907ae6de17
children 88f3cfcff55f
rev   line source
cannam@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@0 2
cannam@0 3 /*
cannam@0 4 QM DSP Library
cannam@0 5
cannam@0 6 Centre for Digital Music, Queen Mary, University of London.
Chris@84 7 This file 2005-2006 Christian Landone.
Chris@84 8
Chris@84 9 This program is free software; you can redistribute it and/or
Chris@84 10 modify it under the terms of the GNU General Public License as
Chris@84 11 published by the Free Software Foundation; either version 2 of the
Chris@84 12 License, or (at your option) any later version. See the file
Chris@84 13 COPYING included with this distribution for more information.
cannam@0 14 */
cannam@0 15
cannam@0 16 // PeakPicking.h: interface for the PeakPicking class.
cannam@0 17 //
cannam@0 18 //////////////////////////////////////////////////////////////////////
cannam@0 19
cannam@0 20 #ifndef PEAKPICKING_H
cannam@0 21 #define PEAKPICKING_H
cannam@0 22
cannam@16 23 #include "maths/MathUtilities.h"
cannam@16 24 #include "maths/MathAliases.h"
cannam@0 25 #include "dsp/signalconditioning/DFProcess.h"
cannam@0 26
cannam@0 27
cannam@12 28 struct PPWinThresh
cannam@0 29 {
cannam@0 30 unsigned int pre;
cannam@0 31 unsigned int post;
cannam@0 32 };
cannam@0 33
cannam@0 34 struct QFitThresh
cannam@0 35 {
cannam@0 36 double a;
cannam@0 37 double b;
cannam@0 38 double c;
cannam@0 39 };
cannam@0 40
cannam@0 41 struct PPickParams
cannam@0 42 {
cannam@0 43 unsigned int length; //Detection FunctionLength
cannam@0 44 double tau; // time resolution of the detection function:
cannam@0 45 unsigned int alpha; //alpha-norm parameter
cannam@0 46 double cutoff;//low-pass Filter cutoff freq
cannam@0 47 unsigned int LPOrd; // low-pass Filter order
cannam@0 48 double* LPACoeffs; //low pass Filter den coefficients
cannam@0 49 double* LPBCoeffs; //low pass Filter num coefficients
cannam@12 50 PPWinThresh WinT;//window size in frames for adaptive thresholding [pre post]:
cannam@0 51 QFitThresh QuadThresh;
cannam@0 52 };
cannam@0 53
cannam@0 54 class PeakPicking
cannam@0 55 {
cannam@0 56 public:
cannam@0 57 PeakPicking( PPickParams Config );
cannam@0 58 virtual ~PeakPicking();
cannam@0 59
cannam@0 60 void process( double* src, unsigned int len, vector<int> &onsets );
cannam@0 61
cannam@0 62
cannam@0 63 private:
cannam@0 64 void initialise( PPickParams Config );
cannam@0 65 void deInitialise();
cannam@0 66 int quadEval( vector<double> &src, vector<int> &idx );
cannam@0 67
cannam@0 68 DFProcConfig m_DFProcessingParams;
cannam@0 69
cannam@0 70 unsigned int m_DFLength ;
cannam@0 71 double Qfilta ;
cannam@0 72 double Qfiltb;
cannam@0 73 double Qfiltc;
cannam@0 74
cannam@0 75
cannam@0 76 double* m_workBuffer;
cannam@0 77
cannam@0 78 DFProcess* m_DFSmoothing;
cannam@0 79 };
cannam@0 80
cannam@0 81 #endif