c@225: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ c@225: c@225: /* c@225: QM DSP Library c@225: c@225: Centre for Digital Music, Queen Mary, University of London. c@225: This file copyright 2005-2006 Christian Landone. c@225: All rights reserved. c@225: */ c@225: c@225: #ifndef CONSTANTQ_H c@225: #define CONSTANTQ_H c@225: c@225: #include c@241: #include "maths/MathAliases.h" c@241: #include "maths/MathUtilities.h" c@225: c@225: struct CQConfig{ c@245: unsigned int FS; // samplerate c@245: double min; // minimum frequency c@245: double max; // maximum frequency c@245: unsigned int BPO; // bins per octave c@245: double CQThresh; // threshold c@225: }; c@225: c@225: class ConstantQ { c@225: c@225: //public functions incl. sparsekernel so can keep out of loop in main c@225: public: c@225: void process( double* FFTRe, double* FFTIm, double* CQRe, double* CQIm ); c@225: c@225: ConstantQ( CQConfig Config ); c@225: ~ConstantQ(); c@225: c@225: double* process( double* FFTData ); c@225: c@225: void sparsekernel(); c@225: c@225: double hamming(int len, int n) { c@225: double out = 0.54 - 0.46*cos(2*PI*n/len); c@225: return(out); c@225: } c@225: c@225: int getnumwin() { return m_numWin;} c@225: double getQ() { return m_dQ;} c@225: int getK() {return m_uK ;} c@225: int getfftlength() { return m_FFTLength;} c@225: int gethop() { return m_hop;} c@225: c@225: private: c@225: void initialise( CQConfig Config ); c@225: void deInitialise(); c@225: c@225: double* m_CQdata; c@225: unsigned int m_FS; c@225: double m_FMin; c@225: double m_FMax; c@225: double m_dQ; c@225: double m_CQThresh; c@225: unsigned int m_numWin; c@225: unsigned int m_hop; c@225: unsigned int m_BPO; c@225: unsigned int m_FFTLength; c@225: unsigned int m_uK; c@225: std::vector m_sparseKernelIs; c@225: std::vector m_sparseKernelJs; c@225: std::vector m_sparseKernelImagValues; c@225: std::vector m_sparseKernelRealValues; c@225: }; c@225: c@225: c@225: #endif//CONSTANTQ_H c@225: