annotate dsp/onsets/PeakPicking.h @ 73:dcb555b90924

* Key detector: when returning key strengths, use the peak value of the three underlying chromagram correlations (from 36-bin chromagram) corresponding to each key, instead of the mean. Rationale: This is the same method as used when returning the key value, and it's nice to have the same results in both returned value and plot. The peak performed better than the sum with a simple test set of triads, so it seems reasonable to change the plot to match the key output rather than the other way around. * FFT: kiss_fftr returns only the non-conjugate bins, synthesise the rest rather than leaving them (perhaps dangerously) undefined. Fixes an uninitialised data error in chromagram that could cause garbage results from key detector. * Constant Q: remove precalculated values again, I reckon they're not proving such a good tradeoff.
author cannam
date Fri, 05 Jun 2009 15:12:39 +0000
parents 2e3f5d2d62c1
children e5907ae6de17
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.
cannam@0 7 This file copyright 2005-2006 Christian Landone.
cannam@0 8 All rights reserved.
cannam@0 9 */
cannam@0 10
cannam@0 11 // PeakPicking.h: interface for the PeakPicking class.
cannam@0 12 //
cannam@0 13 //////////////////////////////////////////////////////////////////////
cannam@0 14
cannam@0 15 #ifndef PEAKPICKING_H
cannam@0 16 #define PEAKPICKING_H
cannam@0 17
cannam@16 18 #include "maths/MathUtilities.h"
cannam@16 19 #include "maths/MathAliases.h"
cannam@0 20 #include "dsp/signalconditioning/DFProcess.h"
cannam@0 21
cannam@0 22
cannam@12 23 struct PPWinThresh
cannam@0 24 {
cannam@0 25 unsigned int pre;
cannam@0 26 unsigned int post;
cannam@0 27 };
cannam@0 28
cannam@0 29 struct QFitThresh
cannam@0 30 {
cannam@0 31 double a;
cannam@0 32 double b;
cannam@0 33 double c;
cannam@0 34 };
cannam@0 35
cannam@0 36 struct PPickParams
cannam@0 37 {
cannam@0 38 unsigned int length; //Detection FunctionLength
cannam@0 39 double tau; // time resolution of the detection function:
cannam@0 40 unsigned int alpha; //alpha-norm parameter
cannam@0 41 double cutoff;//low-pass Filter cutoff freq
cannam@0 42 unsigned int LPOrd; // low-pass Filter order
cannam@0 43 double* LPACoeffs; //low pass Filter den coefficients
cannam@0 44 double* LPBCoeffs; //low pass Filter num coefficients
cannam@12 45 PPWinThresh WinT;//window size in frames for adaptive thresholding [pre post]:
cannam@0 46 QFitThresh QuadThresh;
cannam@0 47 };
cannam@0 48
cannam@0 49 class PeakPicking
cannam@0 50 {
cannam@0 51 public:
cannam@0 52 PeakPicking( PPickParams Config );
cannam@0 53 virtual ~PeakPicking();
cannam@0 54
cannam@0 55 void process( double* src, unsigned int len, vector<int> &onsets );
cannam@0 56
cannam@0 57
cannam@0 58 private:
cannam@0 59 void initialise( PPickParams Config );
cannam@0 60 void deInitialise();
cannam@0 61 int quadEval( vector<double> &src, vector<int> &idx );
cannam@0 62
cannam@0 63 DFProcConfig m_DFProcessingParams;
cannam@0 64
cannam@0 65 unsigned int m_DFLength ;
cannam@0 66 double Qfilta ;
cannam@0 67 double Qfiltb;
cannam@0 68 double Qfiltc;
cannam@0 69
cannam@0 70
cannam@0 71 double* m_workBuffer;
cannam@0 72
cannam@0 73 DFProcess* m_DFSmoothing;
cannam@0 74 };
cannam@0 75
cannam@0 76 #endif