PitchEstimator.cpp

Go to the documentation of this file.
00001 // PitchEstimator.cpp: implementation of the PitchEstimator class.
00002 //
00004 
00005 #include "PitchEstimator.h"
00006 
00008 // Construction/Destruction
00010 
00011 
00016 PitchEstimator::PitchEstimator( double dEnergy1,double dPitch1,
00017                                                                 double dEnergy2,double dPitch2,
00018                                                                 double dEnergy3,double dPitch3)
00019 {
00020         computePitchCoefficients(dEnergy1,dPitch1,dEnergy2,dPitch2,dEnergy3,dPitch3);
00021 }
00022 
00023 PitchEstimator::~PitchEstimator()
00024 {
00025 
00026 }
00027 
00028 
00033 void PitchEstimator::computePitchCoefficients(  double e1,double p1,
00034                                                                                                 double e2,double p2,
00035                                                                                                 double e3,double p3)
00036 {
00037         double dDeno = e2*e1*e1-e2*e3*e3+e1*e3*e3-e1*e2*e2+e3*e2*e2-e3*e1*e1;
00038 
00039         _dCoeffA = (-e2*e2*e1*p3+p2*e1*e3*e3+e1*e1*e2*p3-e1*e1*e3*p2-p1*e2*e3*e3+e2*e2*e3*p1)/dDeno;   
00040         _dCoeffB = (-e2*e2*p1+e2*e2*p3+p1*e3*e3+p2*e1*e1-p2*e3*e3-e1*e1*p3)/dDeno;   
00041         _dCoeffC = -(-e2*p1+e3*p1+e2*p3-e1*p3+e1*p2-e3*p2)/dDeno; 
00042 }
00043 
00044 double PitchEstimator::getCoefficientA()
00045 {
00046         return _dCoeffA;
00047 }
00048 
00049 double PitchEstimator::getCoefficientB()
00050 {
00051         return _dCoeffB;
00052 }
00053 
00054 double PitchEstimator::getCoefficientC()
00055 {
00056         return _dCoeffC;
00057 }
00058 
00059 
00060 

Generated on Fri Jul 10 10:31:55 2009 for Utils Library by  doxygen 1.4.5