Marsyas  0.2
/home/gperciva/src/marsyas/src/marsyas/SeneffEar.h
00001 /*
00002 ** Copyright (C) 1998-2006 George Tzanetakis <gtzan@cs.uvic.ca>
00003 **  
00004 ** This program is free software; you can redistribute it and/or modify
00005 ** it under the terms of the GNU General Public License as published by
00006 ** the Free Software Foundation; either version 2 of the License, or
00007 ** (at your option) any later version.
00008 ** 
00009 ** This program is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 ** GNU General Public License for more details.
00013 ** 
00014 ** You should have received a copy of the GNU General Public License
00015 ** along with this program; if not, write to the Free Software 
00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 */
00018 
00019 #ifndef MARSYAS_SENEFFEAR_H
00020 #define MARSYAS_SENEFFEAR_H
00021 
00022 #include "MarSystem.h"
00023 #include "Filter.h"
00024 #include "Cascade.h"
00025 #include "Parallel.h"
00026 
00027 namespace Marsyas
00028 {
00040 class SeneffEar: public MarSystem
00041 {
00042 private: 
00043   void addControls();
00044     void myUpdate(MarControlPtr sender);
00045   
00046   mrs_natural stage;
00047   
00048   bool firstUpdate;
00049   
00050   mrs_natural channels;
00051   mrs_real fs;
00052   
00053   realvec PreemphasisRThetaCoeffs;
00054   realvec FilterBankRThetaCoeffs;
00055   realvec SeneffPreemphasisCoeffs;
00056   realvec SeneffFilterBankCoeffs;
00057   realvec SeneffForwardCoeffs;
00058   realvec SeneffBackwardCoeffs;
00059   realvec SeneffForwardCoeffsNormalized;
00060   
00061   realvec y;
00062   
00063   Filter* SeneffPreemphasisFilter;
00064   Cascade* SeneffFilterBank;
00065   Parallel* resonatorFilter;
00066   
00067   realvec slice_0;
00068   realvec slice_1;
00069   realvec slice_2;
00070   realvec slice_3;
00071   
00072   mrs_real hwrA;
00073   mrs_real hwrB;
00074   mrs_real hwrG;
00075 
00076   mrs_real Tua;
00077   mrs_real Tub;
00078 
00079   realvec Cn;
00080 
00081   mrs_real lpAlpha;
00082   Filter* lowPassFilter;
00083 
00084   mrs_real initial_yn;
00085   mrs_real alpha_agc;
00086   mrs_real kagc;
00087   Filter* AGCfilter;
00088 
00089   void polyConv(realvec&, realvec&, realvec&);
00090   void polyFlip(realvec&);
00091    
00092 public:
00093   SeneffEar(std::string name);
00094   ~SeneffEar();
00095   
00096   MarSystem* clone() const;
00097 
00098   void myProcess(realvec& in, realvec& out); 
00099 };
00100 
00101 }//namespace Marsyas
00102 
00103 #endif
00104