Ardour  9.0-pre0-582-g084a23a80d
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 CONSTANTQ_H
17 #define CONSTANTQ_H
18 
19 #include <vector>
20 #include "maths/MathAliases.h"
21 #include "maths/MathUtilities.h"
22 
23 struct CQConfig{
24  unsigned int FS; // samplerate
25  double min; // minimum frequency
26  double max; // maximum frequency
27  unsigned int BPO; // bins per octave
28  double CQThresh; // threshold
29 };
30 
31 class ConstantQ {
32 
33 //public functions incl. sparsekernel so can keep out of loop in main
34 public:
35  void process( const double* FFTRe, const double* FFTIm,
36  double* CQRe, double* CQIm );
37 
40 
41  double* process( const double* FFTData );
42 
43  void sparsekernel();
44 
45  double hamming(int len, int n) {
46  double out = 0.54 - 0.46*cos(2*PI*n/len);
47  return(out);
48  }
49 
50  int getnumwin() { return m_numWin;}
51  double getQ() { return m_dQ;}
52  int getK() {return m_uK ;}
53  int getfftlength() { return m_FFTLength;}
54  int gethop() { return m_hop;}
55 
56 private:
58  void deInitialise();
59 
60  double* m_CQdata;
61  unsigned int m_FS;
62  double m_FMin;
63  double m_FMax;
64  double m_dQ;
65  double m_CQThresh;
66  unsigned int m_numWin;
67  unsigned int m_hop;
68  unsigned int m_BPO;
69  unsigned int m_FFTLength;
70  unsigned int m_uK;
71 
72  struct SparseKernel {
73  std::vector<unsigned> is;
74  std::vector<unsigned> js;
75  std::vector<double> imag;
76  std::vector<double> real;
77  };
78 
80 };
81 
82 
83 #endif//CONSTANTQ_H
84 
#define PI
Definition: MathAliases.h:27
unsigned int m_BPO
Definition: ConstantQ.h:68
ConstantQ(CQConfig Config)
void initialise(CQConfig Config)
void process(const double *FFTRe, const double *FFTIm, double *CQRe, double *CQIm)
double * process(const double *FFTData)
int getfftlength()
Definition: ConstantQ.h:53
unsigned int m_FS
Definition: ConstantQ.h:61
double m_dQ
Definition: ConstantQ.h:64
void sparsekernel()
double hamming(int len, int n)
Definition: ConstantQ.h:45
void deInitialise()
unsigned int m_FFTLength
Definition: ConstantQ.h:69
unsigned int m_hop
Definition: ConstantQ.h:67
double getQ()
Definition: ConstantQ.h:51
int gethop()
Definition: ConstantQ.h:54
int getnumwin()
Definition: ConstantQ.h:50
double * m_CQdata
Definition: ConstantQ.h:60
unsigned int m_numWin
Definition: ConstantQ.h:66
int getK()
Definition: ConstantQ.h:52
double m_CQThresh
Definition: ConstantQ.h:65
double m_FMin
Definition: ConstantQ.h:62
SparseKernel * m_sparseKernel
Definition: ConstantQ.h:79
double m_FMax
Definition: ConstantQ.h:63
unsigned int m_uK
Definition: ConstantQ.h:70
RCConfiguration * Config
double CQThresh
Definition: ConstantQ.h:28
double min
Definition: ConstantQ.h:25
unsigned int BPO
Definition: ConstantQ.h:27
unsigned int FS
Definition: ConstantQ.h:24
double max
Definition: ConstantQ.h:26
std::vector< unsigned > js
Definition: ConstantQ.h:74
std::vector< double > imag
Definition: ConstantQ.h:75
std::vector< unsigned > is
Definition: ConstantQ.h:73
std::vector< double > real
Definition: ConstantQ.h:76