cannam@0: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ cannam@0: cannam@0: /* cannam@0: QM DSP Library cannam@0: cannam@0: Centre for Digital Music, Queen Mary, University of London. Chris@84: This file 2005-2006 Christian Landone. Chris@84: Chris@84: This program is free software; you can redistribute it and/or Chris@84: modify it under the terms of the GNU General Public License as Chris@84: published by the Free Software Foundation; either version 2 of the Chris@84: License, or (at your option) any later version. See the file Chris@84: COPYING included with this distribution for more information. cannam@0: */ cannam@0: cannam@0: // PeakPicking.h: interface for the PeakPicking class. cannam@0: // cannam@0: ////////////////////////////////////////////////////////////////////// cannam@0: cannam@0: #ifndef PEAKPICKING_H cannam@0: #define PEAKPICKING_H cannam@0: cannam@16: #include "maths/MathUtilities.h" cannam@16: #include "maths/MathAliases.h" cannam@0: #include "dsp/signalconditioning/DFProcess.h" cannam@0: cannam@0: cannam@12: struct PPWinThresh cannam@0: { cannam@0: unsigned int pre; cannam@0: unsigned int post; cannam@0: }; cannam@0: cannam@0: struct QFitThresh cannam@0: { cannam@0: double a; cannam@0: double b; cannam@0: double c; cannam@0: }; cannam@0: cannam@0: struct PPickParams cannam@0: { cannam@0: unsigned int length; //Detection FunctionLength cannam@0: double tau; // time resolution of the detection function: cannam@0: unsigned int alpha; //alpha-norm parameter cannam@0: double cutoff;//low-pass Filter cutoff freq cannam@0: unsigned int LPOrd; // low-pass Filter order cannam@0: double* LPACoeffs; //low pass Filter den coefficients cannam@0: double* LPBCoeffs; //low pass Filter num coefficients cannam@12: PPWinThresh WinT;//window size in frames for adaptive thresholding [pre post]: cannam@0: QFitThresh QuadThresh; cannam@0: }; cannam@0: cannam@0: class PeakPicking cannam@0: { cannam@0: public: cannam@0: PeakPicking( PPickParams Config ); cannam@0: virtual ~PeakPicking(); cannam@0: cannam@0: void process( double* src, unsigned int len, vector &onsets ); cannam@0: cannam@0: cannam@0: private: cannam@0: void initialise( PPickParams Config ); cannam@0: void deInitialise(); cannam@0: int quadEval( vector &src, vector &idx ); cannam@0: cannam@0: DFProcConfig m_DFProcessingParams; cannam@0: cannam@0: unsigned int m_DFLength ; cannam@0: double Qfilta ; cannam@0: double Qfiltb; cannam@0: double Qfiltc; cannam@0: cannam@0: cannam@0: double* m_workBuffer; cannam@0: cannam@0: DFProcess* m_DFSmoothing; cannam@0: }; cannam@0: cannam@0: #endif