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@309: This file 2005-2006 Christian Landone. c@309: c@309: This program is free software; you can redistribute it and/or c@309: modify it under the terms of the GNU General Public License as c@309: published by the Free Software Foundation; either version 2 of the c@309: License, or (at your option) any later version. See the file c@309: COPYING included with this distribution for more information. 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@257: void process( const double* FFTRe, const double* FFTIm, c@257: double* CQRe, double* CQIm ); c@225: c@225: ConstantQ( CQConfig Config ); c@225: ~ConstantQ(); c@225: c@257: double* process( const 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@276: c@276: struct SparseKernel { c@276: std::vector is; c@276: std::vector js; c@276: std::vector imag; c@276: std::vector real; c@276: }; c@276: c@276: SparseKernel *m_sparseKernel; c@225: }; c@225: c@225: c@225: #endif//CONSTANTQ_H c@225: