qm-dsp
1.8
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 TEMPOTRACK_H
17
#define TEMPOTRACK_H
18
19
20
#include <stdio.h>
21
#include <vector>
22
23
#include "
dsp/signalconditioning/DFProcess.h
"
24
#include "
maths/Correlation.h
"
25
#include "
dsp/signalconditioning/Framer.h
"
26
27
28
29
using
std::vector;
30
31
struct
WinThresh
32
{
33
unsigned
int
pre
;
34
unsigned
int
post
;
35
};
36
37
struct
TTParams
38
{
39
unsigned
int
winLength
;
//Analysis window length
40
unsigned
int
lagLength
;
//Lag & Stride size
41
unsigned
int
alpha
;
//alpha-norm parameter
42
unsigned
int
LPOrd
;
// low-pass Filter order
43
double
*
LPACoeffs
;
//low pass Filter den coefficients
44
double
*
LPBCoeffs
;
//low pass Filter num coefficients
45
WinThresh
WinT
;
//window size in frames for adaptive thresholding [pre post]:
46
};
47
48
49
class
TempoTrack
50
{
51
public
:
52
TempoTrack
(
TTParams
Params );
53
virtual
~
TempoTrack
();
54
55
vector<int> process( vector <double> DF, vector <double> *tempoReturn = 0);
56
57
58
private
:
59
void
initialise(
TTParams
Params );
60
void
deInitialise();
61
62
int
beatPredict(
unsigned
int
FSP,
double
alignment,
double
period,
unsigned
int
step);
63
int
phaseMM(
double
* DF,
double
* weighting,
unsigned
int
winLength,
double
period );
64
void
createPhaseExtractor(
double
*
Filter
,
unsigned
int
winLength,
double
period,
unsigned
int
fsp,
unsigned
int
lastBeat );
65
int
findMeter(
double
* ACF,
unsigned
int
len,
double
period );
66
void
constDetect(
double
* periodP,
int
currentIdx,
int
* flag );
67
void
stepDetect(
double
* periodP,
double
* periodG,
int
currentIdx,
int
* flag );
68
void
createCombFilter(
double
* Filter,
unsigned
int
winLength,
unsigned
int
TSig,
double
beatLag );
69
double
tempoMM(
double
* ACF,
double
* weight,
int
sig );
70
71
unsigned
int
m_dataLength
;
72
unsigned
int
m_winLength
;
73
unsigned
int
m_lagLength
;
74
75
double
m_rayparam
;
76
double
m_sigma
;
77
double
m_DFWVNnorm
;
78
79
vector<int>
m_beats
;
// Vector of detected beats
80
81
double
m_lockedTempo
;
82
83
double
*
m_tempoScratch
;
84
double
*
m_smoothRCF
;
// Smoothed Output of Comb Filterbank (m_tempoScratch)
85
86
// Processing Buffers
87
double
*
m_rawDFFrame
;
// Original Detection Function Analysis Frame
88
double
*
m_smoothDFFrame
;
// Smoothed Detection Function Analysis Frame
89
double
*
m_frameACF
;
// AutoCorrelation of Smoothed Detection Function
90
91
//Low Pass Coefficients for DF Smoothing
92
double
*
m_ACoeffs
;
93
double
*
m_BCoeffs
;
94
95
// Objetcs/operators declaration
96
Framer
m_DFFramer
;
97
DFProcess
*
m_DFConditioning
;
98
Correlation
m_correlator
;
99
// Config structure for DFProcess
100
DFProcConfig
m_DFPParams
;
101
102
// also want to smooth m_tempoScratch
103
DFProcess
*
m_RCFConditioning
;
104
// Config structure for RCFProcess
105
DFProcConfig
m_RCFPParams
;
106
107
108
109
};
110
111
#endif
TTParams::lagLength
unsigned int lagLength
Definition:
TempoTrack.h:40
TempoTrack::m_RCFConditioning
DFProcess * m_RCFConditioning
Definition:
TempoTrack.h:103
TempoTrack::m_smoothDFFrame
double * m_smoothDFFrame
Definition:
TempoTrack.h:88
TTParams
Definition:
TempoTrack.h:37
TempoTrack::m_RCFPParams
DFProcConfig m_RCFPParams
Definition:
TempoTrack.h:105
WinThresh::pre
unsigned int pre
Definition:
TempoTrack.h:33
WinThresh::post
unsigned int post
Definition:
TempoTrack.h:34
TTParams::alpha
unsigned int alpha
Definition:
TempoTrack.h:41
TempoTrack::m_lagLength
unsigned int m_lagLength
Definition:
TempoTrack.h:73
TempoTrack::m_ACoeffs
double * m_ACoeffs
Definition:
TempoTrack.h:92
TempoTrack::m_beats
vector< int > m_beats
Definition:
TempoTrack.h:79
Correlation
Definition:
Correlation.h:21
Filter
Digital filter specified through FilterConfig structure.
Definition:
Filter.h:38
TempoTrack::m_BCoeffs
double * m_BCoeffs
Definition:
TempoTrack.h:93
TTParams::LPOrd
unsigned int LPOrd
Definition:
TempoTrack.h:42
DFProcess
Definition:
DFProcess.h:42
TempoTrack::m_correlator
Correlation m_correlator
Definition:
TempoTrack.h:98
TempoTrack::m_DFPParams
DFProcConfig m_DFPParams
Definition:
TempoTrack.h:100
Framer
Definition:
Framer.h:24
TTParams::LPACoeffs
double * LPACoeffs
Definition:
TempoTrack.h:43
TempoTrack::m_DFFramer
Framer m_DFFramer
Definition:
TempoTrack.h:96
WinThresh
Definition:
TempoTrack.h:31
TTParams::WinT
WinThresh WinT
Definition:
TempoTrack.h:45
Correlation.h
TempoTrack::m_DFWVNnorm
double m_DFWVNnorm
Definition:
TempoTrack.h:77
TempoTrack::m_dataLength
unsigned int m_dataLength
Definition:
TempoTrack.h:71
DFProcConfig
Definition:
DFProcess.h:30
TempoTrack::m_smoothRCF
double * m_smoothRCF
Definition:
TempoTrack.h:84
TempoTrack::m_rawDFFrame
double * m_rawDFFrame
Definition:
TempoTrack.h:87
TempoTrack::m_winLength
unsigned int m_winLength
Definition:
TempoTrack.h:72
TempoTrack::m_sigma
double m_sigma
Definition:
TempoTrack.h:76
TTParams::LPBCoeffs
double * LPBCoeffs
Definition:
TempoTrack.h:44
TempoTrack::m_DFConditioning
DFProcess * m_DFConditioning
Definition:
TempoTrack.h:97
TempoTrack::m_tempoScratch
double * m_tempoScratch
Definition:
TempoTrack.h:83
TTParams::winLength
unsigned int winLength
Definition:
TempoTrack.h:39
TempoTrack::m_rayparam
double m_rayparam
Definition:
TempoTrack.h:75
TempoTrack
Definition:
TempoTrack.h:49
Framer.h
DFProcess.h
TempoTrack::m_lockedTempo
double m_lockedTempo
Definition:
TempoTrack.h:81
TempoTrack::m_frameACF
double * m_frameACF
Definition:
TempoTrack.h:89
dsp
tempotracking
TempoTrack.h
Generated by
1.8.13