Mercurial > hg > qm-dsp
annotate dsp/chromagram/ConstantQ.h @ 228:b7f01ab7045e
* Give the chromagram an alternative entry point passing in frequency domain
data
* Centre the Hamming windows and do an fftshift when calculating sparse kernel
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Mon, 15 May 2006 15:07:27 +0000 |
parents | 49844bc8a895 |
children | 2e3f5d2d62c1 |
rev | line source |
---|---|
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@225 | 7 This file copyright 2005-2006 Christian Landone. |
c@225 | 8 All rights reserved. |
c@225 | 9 */ |
c@225 | 10 |
c@225 | 11 #ifndef CONSTANTQ_H |
c@225 | 12 #define CONSTANTQ_H |
c@225 | 13 |
c@225 | 14 #include <vector> |
c@225 | 15 #include "dsp/maths/MathAliases.h" |
c@225 | 16 #include "dsp/maths/MathUtilities.h" |
c@225 | 17 |
c@225 | 18 struct CQConfig{ |
c@225 | 19 unsigned int FS; |
c@225 | 20 double min; |
c@225 | 21 double max; |
c@225 | 22 unsigned int BPO; |
c@225 | 23 double CQThresh; |
c@225 | 24 }; |
c@225 | 25 |
c@225 | 26 class ConstantQ { |
c@225 | 27 |
c@225 | 28 //public functions incl. sparsekernel so can keep out of loop in main |
c@225 | 29 public: |
c@225 | 30 void process( double* FFTRe, double* FFTIm, double* CQRe, double* CQIm ); |
c@225 | 31 |
c@225 | 32 ConstantQ( CQConfig Config ); |
c@225 | 33 ~ConstantQ(); |
c@225 | 34 |
c@225 | 35 double* process( double* FFTData ); |
c@225 | 36 |
c@225 | 37 void sparsekernel(); |
c@225 | 38 |
c@225 | 39 double hamming(int len, int n) { |
c@225 | 40 double out = 0.54 - 0.46*cos(2*PI*n/len); |
c@225 | 41 return(out); |
c@225 | 42 } |
c@225 | 43 |
c@225 | 44 int getnumwin() { return m_numWin;} |
c@225 | 45 double getQ() { return m_dQ;} |
c@225 | 46 int getK() {return m_uK ;} |
c@225 | 47 int getfftlength() { return m_FFTLength;} |
c@225 | 48 int gethop() { return m_hop;} |
c@225 | 49 |
c@225 | 50 private: |
c@225 | 51 void initialise( CQConfig Config ); |
c@225 | 52 void deInitialise(); |
c@225 | 53 |
c@225 | 54 double* m_CQdata; |
c@225 | 55 unsigned int m_FS; |
c@225 | 56 double m_FMin; |
c@225 | 57 double m_FMax; |
c@225 | 58 double m_dQ; |
c@225 | 59 double m_CQThresh; |
c@225 | 60 unsigned int m_numWin; |
c@225 | 61 unsigned int m_hop; |
c@225 | 62 unsigned int m_BPO; |
c@225 | 63 unsigned int m_FFTLength; |
c@225 | 64 unsigned int m_uK; |
c@225 | 65 std::vector<unsigned> m_sparseKernelIs; |
c@225 | 66 std::vector<unsigned> m_sparseKernelJs; |
c@225 | 67 std::vector<double> m_sparseKernelImagValues; |
c@225 | 68 std::vector<double> m_sparseKernelRealValues; |
c@225 | 69 }; |
c@225 | 70 |
c@225 | 71 |
c@225 | 72 #endif//CONSTANTQ_H |
c@225 | 73 |