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