CLAM-Development
1.1
|
00001 /* 00002 * Copyright (c) 2001-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 #ifndef __LPC_AUTOCORRELATION__ 00022 #define __LPC_AUTOCORRELATION__ 00023 00024 #include "Processing.hxx" 00025 #include "InPort.hxx" 00026 #include "OutPort.hxx" 00027 #include "ProcessingConfig.hxx" 00028 #include "LPModel.hxx" 00029 #include "Spectrum.hxx" 00030 00031 namespace CLAM 00032 { 00033 class Audio; 00034 template < class T > class Array; 00035 00036 class LPCConfig 00037 : public ProcessingConfig 00038 { 00039 public: 00040 DYNAMIC_TYPE_USING_INTERFACE( LPCConfig, 1, ProcessingConfig ); 00044 DYN_ATTRIBUTE( 0, public, unsigned, Order ); 00045 protected: 00046 void DefaultInit(); 00047 }; 00048 00049 class LPC_AutoCorrelation 00050 : public Processing 00051 { 00052 public: 00053 LPC_AutoCorrelation(); 00054 virtual ~LPC_AutoCorrelation(); 00055 00056 const char* GetClassName() const; 00057 00058 const ProcessingConfig& GetConfig() const; 00059 00060 bool Do(); 00061 00062 bool Do( const Audio& in, LPModel& out ); 00063 00064 bool Do( const Audio& in, DataArray& A, DataArray& K, TData& E ); 00065 00066 protected: 00067 InPort<Audio> mAudioIn; 00068 OutPort<LPModel> mLPModelOut; 00069 OutPort<Spectrum> mSpectrumOut; 00070 00071 LPCConfig mCurrentConfig; 00072 00073 bool ConcreteConfigure( const ProcessingConfig& cfg ); 00074 00075 void ComputeAutocorrelation( const Array<TData>& signal, 00076 Array<TData>& acCoeffs ); 00077 00078 void SolveSystemByLevinsonDurbin( const Array<TData>& R, 00079 Array<TData>& A, 00080 Array<TData>& K, 00081 TData& E); 00082 00083 private: 00084 }; 00085 00086 // inlines 00087 00088 inline const char* LPC_AutoCorrelation::GetClassName() const 00089 { 00090 return "LPC_AutoCorrelation"; 00091 } 00092 00093 inline const ProcessingConfig& LPC_AutoCorrelation::GetConfig() const 00094 { 00095 return mCurrentConfig; 00096 } 00097 00098 } 00099 00100 #endif // LPC_AutoCorrelation.hxx 00101