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 CHROMAGRAM_H
|
c@225
|
17 #define CHROMAGRAM_H
|
c@225
|
18
|
c@225
|
19 #include "dsp/transforms/FFT.h"
|
c@257
|
20 #include "base/Window.h"
|
c@225
|
21 #include "ConstantQ.h"
|
c@225
|
22
|
c@225
|
23 struct ChromaConfig{
|
c@225
|
24 unsigned int FS;
|
c@225
|
25 double min;
|
c@225
|
26 double max;
|
c@225
|
27 unsigned int BPO;
|
c@225
|
28 double CQThresh;
|
c@259
|
29 MathUtilities::NormaliseType normalise;
|
c@225
|
30 };
|
c@225
|
31
|
c@225
|
32 class Chromagram
|
c@225
|
33 {
|
c@225
|
34
|
c@225
|
35 public:
|
c@225
|
36 Chromagram( ChromaConfig Config );
|
c@225
|
37 ~Chromagram();
|
c@225
|
38
|
c@257
|
39 double* process( const double *data ); // time domain
|
c@257
|
40 double* process( const double *real, const double *imag ); // frequency domain
|
c@225
|
41 void unityNormalise( double* src );
|
c@225
|
42
|
c@225
|
43 // Complex arithmetic
|
c@225
|
44 double kabs( double real, double imag );
|
c@225
|
45
|
c@225
|
46 // Results
|
c@225
|
47 unsigned int getK() { return m_uK;}
|
c@225
|
48 unsigned int getFrameSize() { return m_frameSize; }
|
c@225
|
49 unsigned int getHopSize() { return m_hopSize; }
|
c@225
|
50
|
c@225
|
51 private:
|
c@225
|
52 int initialise( ChromaConfig Config );
|
c@225
|
53 int deInitialise();
|
c@257
|
54
|
c@257
|
55 Window<double> *m_window;
|
c@257
|
56 double *m_windowbuf;
|
c@225
|
57
|
c@225
|
58 double* m_chromadata;
|
c@225
|
59 double m_FMin;
|
c@225
|
60 double m_FMax;
|
c@225
|
61 unsigned int m_BPO;
|
c@225
|
62 unsigned int m_uK;
|
c@225
|
63
|
c@259
|
64 MathUtilities::NormaliseType m_normalise;
|
c@225
|
65
|
c@225
|
66 unsigned int m_frameSize;
|
c@225
|
67 unsigned int m_hopSize;
|
c@225
|
68
|
c@289
|
69 FFTReal* m_FFT;
|
c@225
|
70 ConstantQ* m_ConstantQ;
|
c@225
|
71
|
c@225
|
72 double* m_FFTRe;
|
c@225
|
73 double* m_FFTIm;
|
c@225
|
74 double* m_CQRe;
|
c@225
|
75 double* m_CQIm;
|
c@225
|
76
|
c@276
|
77 bool m_skGenerated;
|
c@225
|
78 };
|
c@225
|
79
|
c@225
|
80 #endif
|