"WAVELET BASED DENOISING IN SPEECH PROCESSING" in matlab by program..
%%%apply Wavelet Transform[C,L]=wavedec(yoursignal,8,'db4');[d1,d2,d3,d4,d5,d6,d7,d8]=detcoef(C,L,[1,2,3,4,5,6,7,8]);%%%Denoise[thr,sorh,keepapp]=ddencmp('den','wv',yoursignal);cleansignal=wdencmp('gbl',C,L,'db4',8,thr,sorh,keepapp);figureplot(cleansignal)
Here i have done decomposition at level 8 and used Daubechies4 wavelet, you can select the level & wavelets according to your requirement.
Replace “yoursignal” with the name of the signal you are giving.
Please refer Matlab Help for more details. Search “wavelet getting started”, “wavedec”,”detcoef”, “ddencmp”, “wdencmp” in the Help menu and then i feel you wont face any difficulty.
PROGRAM 1:
clear;close all;clc;%%%read the speech signalx1=wavread('late_noise.wav');x2=x1(1:60000);%%%Apply wavelet transform[C,L]=wavedec(x2,8,'db4');%%%Denoise[thr,sorh,keepapp]=ddencmp('den','wv',x2)clean=wdencmp('gbl',C,L,'db4',8,thr,sorh,keepapp);%%%plot the figuresfigureplot(x2);xlabel('original speech signal')hold on;plot(clean,'r');xlabel('denoised speech signal')
EXPLANATION FOR PROGRAM 1:
1. Read your sound file using ‘wavread’ function if it is in .wav format. If it is in some other format then refer ‘file formats’ in MATLAB HELP to determine which function you have to use. Remember 'late_noise.wav' is the name of the test file I used.you will have to write the name of your test file there.
2. Decide what length of the signal you want to analyze. Here I have just used first 60,000 samples. This line is not necessary if you wish to analyze the entire signal.
3. wavedec performs wavelet decomposition of the signal. I hope since you have already read the theory you must know what decomposition is. Discrete wavelet transform is computed using pyramid algorithm. Your signal is passed through a high pass and low pas filter. The low pass output is further passed through a high pass and low pass filter and the process continues. How many times this happens depends on the level you specify. In my program as you can see I have used level 8.At each level the signal is down sampled by a factor of 2. The HIGH PASS output at each stages represent the WAVELET TRANSFORMED data. They are called detail coefficients.If you want to see these coefficients add this to the above program: [d1,d2,d3,d4,d5,d6,d7,d8]=detcoef(C,L,[1
,2,3,4,5,6,7,8]); then using plot function you can plot and see d1,d2 etc. At each level you will observe signal is downsampled by a factor of 2.At d8 you can see your signal is downsampled by 2^8 i.e.60,000/2^8.All this is done for better frequency resolution. Lower frequencies are present at all times, we are mostly concerned with higher frequencies which contains the actual data.Next db4.I have used daubecies wavelet type 4 for my program.No particular reason for that.Actually i have used wavelet transform for ECG signal and since db4 is similar to ECG signal hence that choice.I am not aware of any parameters of speech signal(like ECG has P,Q,R,S,T,U waves),so you will have to make your own choice of wavelet.
4. Next ddencmp.For denosing you need to give some parameters.Like you will have to give some threshold value.Those elements in the signal whose value is lower than the threshold is made zero. This is hard thresholding.In soft thresholding the same procedure is applied but to remove the discontinuities the nonzero values are shrunken towards zero.So, ddencmp gives the default threshold level and by default soft-thresholding is used.Also here ’den’ means you are calculating default values for signal denoising.
5. wdencmp: This is where the actual denoising of the signal begins by taking all the values that were calculated till now.
6. When you are done plot the figure :).
PROGRAM 2:
clear;close all;clc;%%%read the speech signalx1=wavread('late_noise.wav');x2=x1(1:60000);%%%Apply wavelet transformxd = wden(x2,'heursure','s','one',4,'db4');%%%plot the figuresfiguresubplot(2,1,1);plot(x2);xlabel('original speech signal')subplot(2,1,2);plot(xd);xlabel('denoised speech signal')Denoising Speech signal using wavelet
PROGRAM 3:
clear;close all;clc;%%%read the speech signalx1=wavread('late_noise.wav');x2=x1(1:60000);%%%Denoise[thr,sorh,keepapp]=ddencmp('den','wv',x2)clean=wdencmp('gbl',x2,'db4',8,thr,sorh,keepapp);%%%plot the figuresfigureplot(x2);xlabel('original speech signal')hold on;plot(clean,'r');xlabel('denoised speech signal')
Cheers !!!