ConstantQ.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_CONSTANTQ_H
17 #define QM_DSP_CONSTANTQ_H
18 
19 #include <vector>
20 #include "maths/MathAliases.h"
21 #include "maths/MathUtilities.h"
22 
23 struct CQConfig {
24  double FS; // samplerate
25  double min; // minimum frequency
26  double max; // maximum frequency
27  int BPO; // bins per octave
28  double CQThresh; // threshold
29 };
30 
31 class ConstantQ
32 {
33 public:
34  ConstantQ(CQConfig config);
35  ~ConstantQ();
36 
37  void process(const double* FFTRe, const double* FFTIm,
38  double* CQRe, double* CQIm);
39 
40  double* process(const double* FFTData);
41 
42  void sparsekernel();
43 
44  double getQ() { return m_dQ; }
45  int getK() { return m_uK; }
46  int getFFTLength() { return m_FFTLength; }
47  int getHop() { return m_hop; }
48 
49 private:
50  void initialise(CQConfig config);
51  void deInitialise();
52 
53  double* m_CQdata;
54  double m_FS;
55  double m_FMin;
56  double m_FMax;
57  double m_dQ;
58  double m_CQThresh;
59  int m_hop;
60  int m_BPO;
62  int m_uK;
63 
64  struct SparseKernel {
65  std::vector<int> is;
66  std::vector<int> js;
67  std::vector<double> imag;
68  std::vector<double> real;
69  };
70 
72 };
73 
74 
75 #endif//CONSTANTQ_H
76 
int m_FFTLength
Definition: ConstantQ.h:61
std::vector< double > real
Definition: ConstantQ.h:68
int getFFTLength()
Definition: ConstantQ.h:46
double CQThresh
Definition: ConstantQ.h:28
double m_dQ
Definition: ConstantQ.h:57
int BPO
Definition: ConstantQ.h:27
double FS
Definition: ConstantQ.h:24
SparseKernel * m_sparseKernel
Definition: ConstantQ.h:71
double m_FMax
Definition: ConstantQ.h:56
double m_FS
Definition: ConstantQ.h:54
int m_BPO
Definition: ConstantQ.h:60
double max
Definition: ConstantQ.h:26
double min
Definition: ConstantQ.h:25
std::vector< double > imag
Definition: ConstantQ.h:67
double * m_CQdata
Definition: ConstantQ.h:53
int m_uK
Definition: ConstantQ.h:62
std::vector< int > is
Definition: ConstantQ.h:65
double m_FMin
Definition: ConstantQ.h:55
std::vector< int > js
Definition: ConstantQ.h:66
int m_hop
Definition: ConstantQ.h:59
int getHop()
Definition: ConstantQ.h:47
double m_CQThresh
Definition: ConstantQ.h:58
int getK()
Definition: ConstantQ.h:45
double getQ()
Definition: ConstantQ.h:44