annotate dsp/tempotracking/TempoTrack.h @ 489:701233f8ed41

Make include-guards consistent
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 31 May 2019 16:48:37 +0100
parents 7e52c034cf62
children bb78ca3fe7de
rev   line source
cannam@475 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@475 2
cannam@475 3 /*
cannam@475 4 QM DSP Library
cannam@475 5
cannam@475 6 Centre for Digital Music, Queen Mary, University of London.
cannam@475 7 This file 2005-2006 Christian Landone.
cannam@475 8
cannam@475 9 This program is free software; you can redistribute it and/or
cannam@475 10 modify it under the terms of the GNU General Public License as
cannam@475 11 published by the Free Software Foundation; either version 2 of the
cannam@475 12 License, or (at your option) any later version. See the file
cannam@475 13 COPYING included with this distribution for more information.
cannam@475 14 */
cannam@475 15
cannam@489 16 #ifndef QM_DSP_TEMPOTRACK_H
cannam@489 17 #define QM_DSP_TEMPOTRACK_H
cannam@475 18
cannam@475 19
cannam@475 20 #include <stdio.h>
cannam@475 21 #include <vector>
cannam@475 22
cannam@475 23 #include "dsp/signalconditioning/DFProcess.h"
cannam@475 24 #include "maths/Correlation.h"
cannam@475 25 #include "dsp/signalconditioning/Framer.h"
cannam@475 26
cannam@475 27
cannam@475 28
cannam@475 29 using std::vector;
cannam@475 30
cannam@475 31 struct WinThresh
cannam@475 32 {
cannam@475 33 int pre;
cannam@475 34 int post;
cannam@475 35 };
cannam@475 36
cannam@475 37 struct TTParams
cannam@475 38 {
cannam@475 39 int winLength; //Analysis window length
cannam@475 40 int lagLength; //Lag & Stride size
cannam@475 41 int alpha; //alpha-norm parameter
cannam@475 42 int LPOrd; // low-pass Filter order
cannam@475 43 double* LPACoeffs; //low pass Filter den coefficients
cannam@475 44 double* LPBCoeffs; //low pass Filter num coefficients
cannam@475 45 WinThresh WinT;//window size in frames for adaptive thresholding [pre post]:
cannam@475 46 };
cannam@475 47
cannam@475 48
cannam@475 49 class TempoTrack
cannam@475 50 {
cannam@475 51 public:
cannam@475 52 TempoTrack( TTParams Params );
cannam@475 53 virtual ~TempoTrack();
cannam@475 54
cannam@475 55 vector<int> process( vector <double> DF, vector <double> *tempoReturn = 0);
cannam@475 56
cannam@479 57
cannam@475 58 private:
cannam@475 59 void initialise( TTParams Params );
cannam@475 60 void deInitialise();
cannam@475 61
cannam@475 62 int beatPredict( int FSP, double alignment, double period, int step);
cannam@475 63 int phaseMM( double* DF, double* weighting, int winLength, double period );
cannam@475 64 void createPhaseExtractor( double* Filter, int winLength, double period, int fsp, int lastBeat );
cannam@475 65 int findMeter( double* ACF, int len, double period );
cannam@475 66 void constDetect( double* periodP, int currentIdx, int* flag );
cannam@475 67 void stepDetect( double* periodP, double* periodG, int currentIdx, int* flag );
cannam@475 68 void createCombFilter( double* Filter, int winLength, int TSig, double beatLag );
cannam@475 69 double tempoMM( double* ACF, double* weight, int sig );
cannam@479 70
cannam@475 71 int m_dataLength;
cannam@475 72 int m_winLength;
cannam@475 73 int m_lagLength;
cannam@475 74
cannam@475 75 double m_rayparam;
cannam@475 76 double m_sigma;
cannam@475 77 double m_DFWVNnorm;
cannam@475 78
cannam@479 79 vector<int> m_beats; // Vector of detected beats
cannam@475 80
cannam@475 81 double m_lockedTempo;
cannam@475 82
cannam@475 83 double* m_tempoScratch;
cannam@475 84 double* m_smoothRCF; // Smoothed Output of Comb Filterbank (m_tempoScratch)
cannam@479 85
cannam@475 86 // Processing Buffers
cannam@475 87 double* m_rawDFFrame; // Original Detection Function Analysis Frame
cannam@475 88 double* m_smoothDFFrame; // Smoothed Detection Function Analysis Frame
cannam@475 89 double* m_frameACF; // AutoCorrelation of Smoothed Detection Function
cannam@475 90
cannam@475 91 //Low Pass Coefficients for DF Smoothing
cannam@475 92 double* m_ACoeffs;
cannam@475 93 double* m_BCoeffs;
cannam@479 94
cannam@475 95 // Objetcs/operators declaration
cannam@475 96 Framer m_DFFramer;
cannam@475 97 DFProcess* m_DFConditioning;
cannam@475 98 Correlation m_correlator;
cannam@475 99 // Config structure for DFProcess
cannam@475 100 DFProcConfig m_DFPParams;
cannam@475 101
cannam@479 102 // also want to smooth m_tempoScratch
cannam@475 103 DFProcess* m_RCFConditioning;
cannam@475 104 // Config structure for RCFProcess
cannam@475 105 DFProcConfig m_RCFPParams;
cannam@475 106 };
cannam@475 107
cannam@475 108 #endif