CLAM-Development
1.1
|
00001 /* 00002 * Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG) 00003 * UNIVERSITAT POMPEU FABRA 00004 * 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 */ 00021 00022 #ifndef __CEPSTRALTRANSFORM__ 00023 #define __CEPSTRALTRANSFORM__ 00024 00025 #include "Processing.hxx" 00026 #include "MelSpectrum.hxx" 00027 #include "MelCepstrum.hxx" 00028 #include "Array.hxx" 00029 #include "InPort.hxx" 00030 #include "OutPort.hxx" 00031 00032 namespace CLAM 00033 { 00034 00035 class CepstralTransformConfig : public ProcessingConfig 00036 { 00037 public: 00038 00039 DYNAMIC_TYPE_USING_INTERFACE( CepstralTransformConfig, 3, ProcessingConfig ); 00040 00042 DYN_ATTRIBUTE( 0, public, TSize, NumMelCoefficients ); 00044 DYN_ATTRIBUTE( 1, public, TSize, NumCepstrumCoefficients ); 00046 DYN_ATTRIBUTE( 2, public, bool, UseBase10 ); 00047 00048 protected: 00049 void DefaultInit(); 00050 }; 00051 00063 class CepstralTransform : public Processing 00064 { 00065 public: 00066 CepstralTransform( ); 00067 00068 CepstralTransform( const CepstralTransformConfig& cfg ); 00069 00070 00071 bool Do(); 00072 00082 bool Do( const MelSpectrum& melCoeffs, MelCepstrum& cepsCoeffs ); 00083 00084 const ProcessingConfig& GetConfig() const 00085 { 00086 return mConfig; 00087 } 00088 00089 const char* GetClassName() const 00090 { 00091 return "CepstralTransform"; 00092 } 00093 00094 00095 protected: 00096 00097 bool ConcreteConfigure( const ProcessingConfig& cfg ); 00098 bool ConcreteStart(); 00099 00100 private: 00101 CepstralTransformConfig mConfig; 00102 DataArray mLogBuffer; 00103 InPort<MelSpectrum> mIn; 00104 OutPort<MelCepstrum> mOut; 00105 00106 }; 00107 00108 } 00109 #endif // CepstralTransform.hxx 00110