annotate dsp/tempotracking/TempoTrack.h @ 225:49844bc8a895

* Queen Mary C++ DSP library
author Chris Cannam <c.cannam@qmul.ac.uk>
date Wed, 05 Apr 2006 17:35:59 +0000
parents
children a9bf0cfe9383
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@225 7 This file copyright 2005-2006 Christian Landone.
c@225 8 All rights reserved.
c@225 9 */
c@225 10
c@225 11 #ifndef TEMPOTRACK_H
c@225 12 #define TEMPOTRACK_H
c@225 13
c@225 14
c@225 15 #include <stdio.h>
c@225 16 #include <vector>
c@225 17
c@225 18 #include "dsp/signalconditioning/DFProcess.h"
c@225 19 #include "dsp/maths/Correlation.h"
c@225 20 #include "dsp/signalconditioning/Framer.h"
c@225 21
c@225 22
c@225 23
c@225 24 using std::vector;
c@225 25
c@225 26 struct WinThresh
c@225 27 {
c@225 28 unsigned int pre;
c@225 29 unsigned int post;
c@225 30 };
c@225 31
c@225 32 struct TTParams
c@225 33 {
c@225 34 unsigned int winLength; //Analysis window length
c@225 35 unsigned int lagLength; //Lag & Stride size
c@225 36 unsigned int alpha; //alpha-norm parameter
c@225 37 unsigned int LPOrd; // low-pass Filter order
c@225 38 double* LPACoeffs; //low pass Filter den coefficients
c@225 39 double* LPBCoeffs; //low pass Filter num coefficients
c@225 40 WinThresh WinT;//window size in frames for adaptive thresholding [pre post]:
c@225 41 };
c@225 42
c@225 43
c@225 44 class TempoTrack
c@225 45 {
c@225 46 public:
c@225 47 TempoTrack( TTParams Params );
c@225 48 virtual ~TempoTrack();
c@225 49
c@225 50 vector<int> process( vector <double> DF );
c@225 51 vector<int> process( double* DF, unsigned int length );
c@225 52
c@225 53
c@225 54 private:
c@225 55 void initialise( TTParams Params );
c@225 56 void deInitialise();
c@225 57
c@225 58 int beatPredict( unsigned int FSP, double alignment, double period, unsigned int step);
c@225 59 int phaseMM( double* DF, double* weighting, unsigned int winLength, double period );
c@225 60 void createPhaseExtractor( double* Filter, unsigned int winLength, double period, unsigned int fsp, unsigned int lastBeat );
c@225 61 int findMeter( double* ACF, unsigned int len, double period );
c@225 62 void constDetect( double* periodP, int currentIdx, int* flag );
c@225 63 void stepDetect( double* periodP, double* periodG, int currentIdx, int* flag );
c@225 64 void createCombFilter( double* Filter, unsigned int winLength, unsigned int TSig, double beatLag );
c@225 65 double tempoMM( double* ACF, double* weight, int sig );
c@225 66
c@225 67 unsigned int m_dataLength;
c@225 68 unsigned int m_winLength;
c@225 69 unsigned int m_lagLength;
c@225 70
c@225 71 double m_rayparam;
c@225 72 double m_sigma;
c@225 73 double m_DFWVNnorm;
c@225 74
c@225 75 vector<int> m_beats; // Vector of detected beats
c@225 76
c@225 77 double* m_tempoScratch;
c@225 78
c@225 79 // Processing Buffers
c@225 80 double* m_rawDFFrame; // Original Detection Function Analysis Frame
c@225 81 double* m_smoothDFFrame; // Smoothed Detection Function Analysis Frame
c@225 82 double* m_frameACF; // AutoCorrelation of Smoothed Detection Function
c@225 83
c@225 84 //Low Pass Coefficients for DF Smoothing
c@225 85 double* m_ACoeffs;
c@225 86 double* m_BCoeffs;
c@225 87
c@225 88 // Objetcs/operators declaration
c@225 89 Framer m_DFFramer;
c@225 90 DFProcess* m_DFConditioning;
c@225 91 Correlation m_correlator;
c@225 92
c@225 93 // Config structure for DFProcess
c@225 94 DFProcConfig m_DFPParams;
c@225 95 };
c@225 96
c@225 97 #endif