annotate dsp/tempotracking/TempoTrack.h @ 96:88f3cfcff55f

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 e5907ae6de17
children e4a57215ddee
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.
mathieu@96 8
mathieu@96 9 This program is free software; you can redistribute it and/or
mathieu@96 10 modify it under the terms of the GNU General Public License as
mathieu@96 11 published by the Free Software Foundation; either version 2 of the
mathieu@96 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 #ifndef TEMPOTRACK_H
cannam@0 17 #define TEMPOTRACK_H
cannam@0 18
cannam@0 19
cannam@0 20 #include <stdio.h>
cannam@0 21 #include <vector>
cannam@0 22
cannam@0 23 #include "dsp/signalconditioning/DFProcess.h"
cannam@16 24 #include "maths/Correlation.h"
cannam@0 25 #include "dsp/signalconditioning/Framer.h"
cannam@0 26
cannam@0 27
cannam@0 28
cannam@0 29 using std::vector;
cannam@0 30
cannam@0 31 struct WinThresh
cannam@0 32 {
cannam@0 33 unsigned int pre;
mathieu@96 34 unsigned int post;
cannam@0 35 };
cannam@0 36
cannam@0 37 struct TTParams
cannam@0 38 {
cannam@0 39 unsigned int winLength; //Analysis window length
cannam@0 40 unsigned int lagLength; //Lag & Stride size
cannam@0 41 unsigned int alpha; //alpha-norm parameter
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@0 45 WinThresh WinT;//window size in frames for adaptive thresholding [pre post]:
cannam@0 46 };
cannam@0 47
cannam@0 48
cannam@0 49 class TempoTrack
cannam@0 50 {
cannam@0 51 public:
cannam@0 52 TempoTrack( TTParams Params );
cannam@0 53 virtual ~TempoTrack();
cannam@0 54
cannam@6 55 vector<int> process( vector <double> DF, vector <double> *tempoReturn = 0);
cannam@0 56
cannam@0 57
cannam@0 58 private:
cannam@0 59 void initialise( TTParams Params );
cannam@0 60 void deInitialise();
cannam@0 61
cannam@0 62 int beatPredict( unsigned int FSP, double alignment, double period, unsigned int step);
cannam@0 63 int phaseMM( double* DF, double* weighting, unsigned int winLength, double period );
cannam@0 64 void createPhaseExtractor( double* Filter, unsigned int winLength, double period, unsigned int fsp, unsigned int lastBeat );
cannam@0 65 int findMeter( double* ACF, unsigned int len, double period );
cannam@0 66 void constDetect( double* periodP, int currentIdx, int* flag );
cannam@0 67 void stepDetect( double* periodP, double* periodG, int currentIdx, int* flag );
cannam@0 68 void createCombFilter( double* Filter, unsigned int winLength, unsigned int TSig, double beatLag );
cannam@0 69 double tempoMM( double* ACF, double* weight, int sig );
cannam@0 70
cannam@0 71 unsigned int m_dataLength;
cannam@0 72 unsigned int m_winLength;
cannam@0 73 unsigned int m_lagLength;
cannam@0 74
cannam@0 75 double m_rayparam;
cannam@0 76 double m_sigma;
cannam@0 77 double m_DFWVNnorm;
cannam@0 78
cannam@0 79 vector<int> m_beats; // Vector of detected beats
cannam@0 80
cannam@6 81 double m_lockedTempo;
cannam@6 82
cannam@0 83 double* m_tempoScratch;
cannam@39 84 double* m_smoothRCF; // Smoothed Output of Comb Filterbank (m_tempoScratch)
cannam@0 85
cannam@0 86 // Processing Buffers
cannam@0 87 double* m_rawDFFrame; // Original Detection Function Analysis Frame
cannam@0 88 double* m_smoothDFFrame; // Smoothed Detection Function Analysis Frame
cannam@0 89 double* m_frameACF; // AutoCorrelation of Smoothed Detection Function
cannam@0 90
cannam@0 91 //Low Pass Coefficients for DF Smoothing
cannam@0 92 double* m_ACoeffs;
cannam@0 93 double* m_BCoeffs;
cannam@0 94
cannam@0 95 // Objetcs/operators declaration
cannam@0 96 Framer m_DFFramer;
cannam@0 97 DFProcess* m_DFConditioning;
cannam@0 98 Correlation m_correlator;
cannam@0 99 // Config structure for DFProcess
cannam@0 100 DFProcConfig m_DFPParams;
cannam@39 101
cannam@39 102 // also want to smooth m_tempoScratch
cannam@39 103 DFProcess* m_RCFConditioning;
cannam@39 104 // Config structure for RCFProcess
cannam@39 105 DFProcConfig m_RCFPParams;
cannam@39 106
cannam@39 107
cannam@39 108
cannam@0 109 };
cannam@0 110
cannam@0 111 #endif