I have seen your work on an echo canceller and I was impressed. Am a graduate student at Kyambogo university trying to implement a simulation of a echo canceller using C++ builder the background code for the lms algorithm has totally refused to work out because the filter cant run until a minimum mean square error is got but raises an overflow error here is my code please look through it and help me debug it. I have my final presentation on 12th may Saturday. Please you help and recommendation will be highly appreciated thanks. The program reads in a wave file of both the contaminated and reference signal for the FIR and pass 512 samples of each of these signals to this implement function for LMS processing so as to cancel the echo in them. I don�t know where I am going wrong Header class fir_filter{ protected: //can accessed outside the class by classes inherited from this class float *coeffs; //a pointer to mem of coeficients double *p_inputs; // apointer to mem of previous inputs double* err_sig; int sample_no; float adapt_s_size; double* contmd_sig; public: double* cheat(double *cont, double *nois, int no_s); void free_mem(); void clear_inputs(int length); double* implement(int length, double* p_inputs, double* contmd_sig, int sample_no); }; Cpp file double* fir_filter::implement(int length, double* p_inputs, double* contmd_sig, int sample_no) { double ref_sig[1000], toxic_sig[1000], N[1000], req_sig[1000]; double MSE; float w[512]; float adapt_s_size = 0.0; for(int k=0;k<sample_no;k++) { ref_sig[k] = *(p_inputs+k); toxic_sig[k] = *(contmd_sig+k); }; for(int i=0;i<length;i++) { w[i] = i*2.354; }; for(int l=0;l<sample_no;l++) { adapt_s_size += ref_sig[sample_no-l]*ref_sig[l]; }; adapt_s_size = 1/adapt_s_size; do{ MSE = 0; for(int k=0;k<sample_no;k++) { N[k]=0; if(k!=0) { for(int i=0;i<length;i++) { if((k-i)<0) { ref_sig[k-i]=0; }; w[i] = w[i] + 2*req_sig[k]*ref_sig[k-i]*adapt_s_size; }; }; for(int i=0;i<length;i++) { if((k-i)<0) { ref_sig[k-i]=0; }; N[k] += w[i]*ref_sig[k-i]; //cout<<"\nthe value of n:\t"<<N[k]; }; req_sig[k] = toxic_sig[k] - N[k]; MSE += pow(req_sig[k], 2); // cout<<"\nthe value of e:\t"<<req_sig[k]; } MSE = MSE/sample_no; cout<<"\nthe value of esq:\t"<<MSE; }while(MSE>0.01); return req_sig; }; _____________________________________ Do you know a company who employs DSP engineers? Is it already listed at http://dsprelated.com/employers.php ?
project echo canceller
Started by ●May 7, 2007
Reply by ●May 7, 20072007-05-07
On May 7, 10:38 am, "zalix" <zalix2...@gmail.com> wrote:> I have seen your work on an echo canceller and I was impressed. Am a > graduate student at Kyambogo university trying to implement a simulation > of a echo canceller using C++ builder the background code for the lms > algorithm has totally refused to work out because the filter cant run > until a minimum mean square error is got but raises an overflow error here > is my code please look through it and help me debug it. I have my final > presentation on 12th may Saturday. Please you help and recommendation will > be highly appreciated thanks. > > The program reads in a wave file of both the contaminated and reference > signal for the FIR and pass 512 samples of each of these signals to this > implement function for LMS processing so as to cancel the echo in them. I > don't know where I am going wrong > > HeaderHave you tried making learning parameter smaller? Do you still get overflows when the parameter is zero? If not step it up. Or you can use a normalized LMS algo and then the learning parameter is in [0,1] Clay