cannam@0: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ cannam@0: cannam@0: /* cannam@0: QM DSP Library cannam@0: cannam@0: Centre for Digital Music, Queen Mary, University of London. Chris@84: This file 2005-2006 Christian Landone. Chris@84: Chris@84: This program is free software; you can redistribute it and/or Chris@84: modify it under the terms of the GNU General Public License as Chris@84: published by the Free Software Foundation; either version 2 of the Chris@84: License, or (at your option) any later version. See the file Chris@84: COPYING included with this distribution for more information. cannam@0: */ cannam@0: cannam@0: #ifndef CONSTANTQ_H cannam@0: #define CONSTANTQ_H cannam@0: cannam@0: #include cannam@16: #include "maths/MathAliases.h" cannam@16: #include "maths/MathUtilities.h" cannam@0: cannam@0: struct CQConfig{ cannam@20: unsigned int FS; // samplerate cannam@20: double min; // minimum frequency cannam@20: double max; // maximum frequency cannam@20: unsigned int BPO; // bins per octave cannam@20: double CQThresh; // threshold cannam@0: }; cannam@0: cannam@0: class ConstantQ { cannam@0: cannam@0: //public functions incl. sparsekernel so can keep out of loop in main cannam@0: public: cannam@32: void process( const double* FFTRe, const double* FFTIm, cannam@32: double* CQRe, double* CQIm ); cannam@0: cannam@0: ConstantQ( CQConfig Config ); cannam@0: ~ConstantQ(); cannam@0: cannam@32: double* process( const double* FFTData ); cannam@0: cannam@0: void sparsekernel(); cannam@0: cannam@0: double hamming(int len, int n) { cannam@0: double out = 0.54 - 0.46*cos(2*PI*n/len); cannam@0: return(out); cannam@0: } cannam@0: cannam@0: int getnumwin() { return m_numWin;} cannam@0: double getQ() { return m_dQ;} cannam@0: int getK() {return m_uK ;} cannam@0: int getfftlength() { return m_FFTLength;} cannam@0: int gethop() { return m_hop;} cannam@0: cannam@0: private: cannam@0: void initialise( CQConfig Config ); cannam@0: void deInitialise(); cannam@0: cannam@0: double* m_CQdata; cannam@0: unsigned int m_FS; cannam@0: double m_FMin; cannam@0: double m_FMax; cannam@0: double m_dQ; cannam@0: double m_CQThresh; cannam@0: unsigned int m_numWin; cannam@0: unsigned int m_hop; cannam@0: unsigned int m_BPO; cannam@0: unsigned int m_FFTLength; cannam@0: unsigned int m_uK; cannam@51: cannam@51: struct SparseKernel { cannam@51: std::vector is; cannam@51: std::vector js; cannam@51: std::vector imag; cannam@51: std::vector real; cannam@51: }; cannam@51: cannam@51: SparseKernel *m_sparseKernel; cannam@0: }; cannam@0: cannam@0: cannam@0: #endif//CONSTANTQ_H cannam@0: