annotate dsp/onsets/PeakPicking.h @ 154:f47182362b51

Update non-qmake build system, remove qmake-based one
author Chris Cannam
date Mon, 21 Oct 2013 17:49:10 +0100
parents 88f3cfcff55f
children fdaa63607c15
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
mathieu@96 9 Modifications:
mathieu@96 10
mathieu@96 11 - delta threshold
mathieu@96 12 Description: add delta threshold used as offset in the smoothed
mathieu@96 13 detection function
mathieu@96 14 Author: Mathieu Barthet
mathieu@96 15 Date: June 2010
mathieu@96 16
Chris@84 17 This program is free software; you can redistribute it and/or
Chris@84 18 modify it under the terms of the GNU General Public License as
Chris@84 19 published by the Free Software Foundation; either version 2 of the
Chris@84 20 License, or (at your option) any later version. See the file
Chris@84 21 COPYING included with this distribution for more information.
cannam@0 22 */
cannam@0 23
cannam@0 24 // PeakPicking.h: interface for the PeakPicking class.
cannam@0 25 //
cannam@0 26 //////////////////////////////////////////////////////////////////////
cannam@0 27
cannam@0 28 #ifndef PEAKPICKING_H
cannam@0 29 #define PEAKPICKING_H
cannam@0 30
cannam@16 31 #include "maths/MathUtilities.h"
cannam@16 32 #include "maths/MathAliases.h"
cannam@0 33 #include "dsp/signalconditioning/DFProcess.h"
cannam@0 34
cannam@0 35
cannam@12 36 struct PPWinThresh
cannam@0 37 {
cannam@0 38 unsigned int pre;
cannam@0 39 unsigned int post;
mathieu@96 40
mathieu@96 41 PPWinThresh(unsigned int x, unsigned int y) :
mathieu@96 42 pre(x),
mathieu@96 43 post(y)
mathieu@96 44 {
mathieu@96 45 }
cannam@0 46 };
cannam@0 47
cannam@0 48 struct QFitThresh
cannam@0 49 {
cannam@0 50 double a;
cannam@0 51 double b;
cannam@0 52 double c;
mathieu@96 53
mathieu@96 54 QFitThresh(double x, double y, double z) :
mathieu@96 55 a(x),
mathieu@96 56 b(y),
mathieu@96 57 c(z)
mathieu@96 58 {
mathieu@96 59 }
cannam@0 60 };
cannam@0 61
cannam@0 62 struct PPickParams
cannam@0 63 {
cannam@0 64 unsigned int length; //Detection FunctionLength
mathieu@96 65 double tau; // time resolution of the detection function
cannam@0 66 unsigned int alpha; //alpha-norm parameter
cannam@0 67 double cutoff;//low-pass Filter cutoff freq
cannam@0 68 unsigned int LPOrd; // low-pass Filter order
cannam@0 69 double* LPACoeffs; //low pass Filter den coefficients
cannam@0 70 double* LPBCoeffs; //low pass Filter num coefficients
cannam@12 71 PPWinThresh WinT;//window size in frames for adaptive thresholding [pre post]:
cannam@0 72 QFitThresh QuadThresh;
mathieu@96 73 float delta; //delta threshold used as an offset when computing the smoothed detection function
mathieu@96 74
mathieu@96 75 PPickParams() :
mathieu@96 76 length(0),
mathieu@96 77 tau(0),
mathieu@96 78 alpha(0),
mathieu@96 79 cutoff(0),
mathieu@96 80 LPOrd(0),
mathieu@96 81 LPACoeffs(NULL),
mathieu@96 82 LPBCoeffs(NULL),
mathieu@96 83 WinT(0,0),
mathieu@96 84 QuadThresh(0,0,0),
mathieu@96 85 delta(0)
mathieu@96 86 {
mathieu@96 87 }
cannam@0 88 };
cannam@0 89
cannam@0 90 class PeakPicking
cannam@0 91 {
cannam@0 92 public:
cannam@0 93 PeakPicking( PPickParams Config );
cannam@0 94 virtual ~PeakPicking();
cannam@0 95
cannam@0 96 void process( double* src, unsigned int len, vector<int> &onsets );
cannam@0 97
cannam@0 98
cannam@0 99 private:
cannam@0 100 void initialise( PPickParams Config );
cannam@0 101 void deInitialise();
cannam@0 102 int quadEval( vector<double> &src, vector<int> &idx );
cannam@0 103
cannam@0 104 DFProcConfig m_DFProcessingParams;
cannam@0 105
cannam@0 106 unsigned int m_DFLength ;
cannam@0 107 double Qfilta ;
cannam@0 108 double Qfiltb;
cannam@0 109 double Qfiltc;
cannam@0 110
cannam@0 111
cannam@0 112 double* m_workBuffer;
cannam@0 113
cannam@0 114 DFProcess* m_DFSmoothing;
cannam@0 115 };
cannam@0 116
cannam@0 117 #endif