annotate dsp/onsets/PeakPicking.h @ 321:f1e6be2de9a5

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