qm-dsp
1.8
|
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 00002 00003 /* 00004 QM DSP Library 00005 00006 Centre for Digital Music, Queen Mary, University of London. 00007 This file 2005-2006 Christian Landone. 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License as 00011 published by the Free Software Foundation; either version 2 of the 00012 License, or (at your option) any later version. See the file 00013 COPYING included with this distribution for more information. 00014 */ 00015 00016 #ifndef CHROMAGRAM_H 00017 #define CHROMAGRAM_H 00018 00019 #include "dsp/transforms/FFT.h" 00020 #include "base/Window.h" 00021 #include "ConstantQ.h" 00022 00023 struct ChromaConfig{ 00024 unsigned int FS; 00025 double min; 00026 double max; 00027 unsigned int BPO; 00028 double CQThresh; 00029 MathUtilities::NormaliseType normalise; 00030 }; 00031 00032 class Chromagram 00033 { 00034 00035 public: 00036 Chromagram( ChromaConfig Config ); 00037 ~Chromagram(); 00038 00039 double* process( const double *data ); // time domain 00040 double* process( const double *real, const double *imag ); // frequency domain 00041 void unityNormalise( double* src ); 00042 00043 // Complex arithmetic 00044 double kabs( double real, double imag ); 00045 00046 // Results 00047 unsigned int getK() { return m_uK;} 00048 unsigned int getFrameSize() { return m_frameSize; } 00049 unsigned int getHopSize() { return m_hopSize; } 00050 00051 private: 00052 int initialise( ChromaConfig Config ); 00053 int deInitialise(); 00054 00055 Window<double> *m_window; 00056 double *m_windowbuf; 00057 00058 double* m_chromadata; 00059 double m_FMin; 00060 double m_FMax; 00061 unsigned int m_BPO; 00062 unsigned int m_uK; 00063 00064 MathUtilities::NormaliseType m_normalise; 00065 00066 unsigned int m_frameSize; 00067 unsigned int m_hopSize; 00068 00069 FFTReal* m_FFT; 00070 ConstantQ* m_ConstantQ; 00071 00072 double* m_FFTRe; 00073 double* m_FFTIm; 00074 double* m_CQRe; 00075 double* m_CQIm; 00076 00077 bool m_skGenerated; 00078 }; 00079 00080 #endif