annotate dsp/tempotracking/TempoTrack.h @ 309:d5014ab8b0e5

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