Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/marsystems/BICchangeDetector.h
Go to the documentation of this file.
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 BICCHANGEDETECTOR_H
00020 #define BICCHANGEDETECTOR_H
00021 
00022 #include <marsyas/system/MarSystem.h>
00023 #include <marsyas/QGMMModel.h>
00024 #include <time.h>
00025 
00026 namespace Marsyas
00027 {
00041 class Memory;
00042 
00043 class BICchangeDetector: public MarSystem
00044 {
00045 private:
00046   mrs_natural segFrames_; //number of frames per audio segment
00047   mrs_natural minSegFrames_; //minimum nr of frames to avoid ill-cov matrices
00048   mrs_natural segHop_;
00049   mrs_natural nfeats_;
00050   mrs_natural BICTick_; // number of ticks so far
00051   mrs_real hopSeconds_; // number of millis per hop
00052   mrs_real prev_change_time_;
00053 
00054 
00055   realvec C1_;
00056   realvec C2_;
00057   realvec C3_;
00058   realvec C4_;
00059   mrs_real dist12_;
00060   mrs_real dist34_;
00061   mrs_real BICdist_;
00062 
00063   //dynamic thresholding parameters
00064   mrs_natural nrPrevDists_;
00065   Memory* prevDists_;
00066   realvec pdists_;
00067   // the index of the latest distance in Memory prevDists_
00068   mrs_natural pIndex_;
00069   mrs_real dynThres_;
00070   // dynamic threshold parameter
00071   mrs_real alpha1_;
00072 
00073   //BIC parameter
00074   mrs_real lambda_;
00075 
00076   //quasi-GMM model
00077   QGMMModel QGMMmodel_;
00078 
00079   MarControlPtr ctrl_reset_;
00080   MarControlPtr ctrl_prevDists_;
00081   MarControlPtr ctrl_alpha1_;
00082   MarControlPtr ctrl_lambda_;
00083   MarControlPtr ctrl_hopMS_; // number of millis per hop
00084 
00085   void addControls();
00086   void myUpdate(MarControlPtr sender);
00087 
00088 public:
00089   BICchangeDetector(std::string name);
00090   BICchangeDetector(const BICchangeDetector& a);
00091   ~BICchangeDetector();
00092   MarSystem* clone() const;
00093 
00094   void myProcess(realvec& in, realvec& out);
00095 };
00096 
00097 }//namespace Marsyas
00098 
00099 #endif