# De Nosing By Wavelet Thresholding And Transform Computer Science Essay

Published:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

In this project the experimenter will seek to design and implement techniques in order to denoise a noisy audio signal using the MATLAB software and its functions, a literature review will be done and summarized to give details of the contribution to the area of study. Different techniques that have been used in the audio and speech processing procedure will be analyzed and studied. The implementation will be done using MATLAB version 7.0.

## Introduction

Given a signal, the Fourier analysis can be used to calculate the frequency and amplitude component that makes up the signal, the Fourier transform is a very powerful tool to analyze components of stationary signals, these are signals that repeats, signals that are composed of sine and cosine components, but in terms of analyzing non stationary signals, these are signals that have no repetition in the region that is sampled, the Fourier transform is not very efficient. Wavelet transform on the other hand allows for these signals to be analyzed. The basic concept behind wavelets is that a signal can be analyzed by splicing into frequency of different components and then these components are studied individually. In terms of Fourier analysis the signal is analyzed in terms of its sine and cosine components but when a wavelet approach is adapted then the analysis is different, the wavelet algorithm that is employed process and analyzed the data on different scales and resolution as compared to Fourier analysis.

In using wavelet analysis, a wavelet type known as the mother wavelet is used as the wavelet prototype function for analysis; analysis is then performed from the mother wavelet that is of higher frequency. The frequency analysis is performed with a dilated version of the said mother wavelet. From the wavelet components that are achieved via this process further analysis can be done on these coefficients.

Wavelets first appeared in an appendix to the thesis of A. Haar (1909). Haar wavelet ptypes are very compact and this is one of their defining features, its compact ability, as the interval gets so large it then starts to vanish, but the Haar wavelets have a major limiting factor they are not continuously differentiable. The analysis of a signal can be done in its time domain for its frequency content, and on this basis this is the Fourier transform, a function in the time domain is first translated to a function that is in the frequency domain. The signal can now be analyzed for its frequency content; this is so because the Fourier content represents the contribution of the sine and cosine components of each frequency. A finite set of sampled points are analyzed based on Fourier transform and the discrete Fourier transform is realized from these points , these sample points are typical to what the original signal looks like. To gather the approximate function of a sample and to gather the approximate Fourier integral using the discrete fourier transform, entails the utilization of a matrix, this matrix contains an order of the number of sample points, say n; and since the multiplication of a nxn matrix with a vector on the order of n raised to the power of 2 arithmetic operations, the problems encountered worsens as the number of samples are increased. If there is uniform spacing between the samples then it is possible to factor in the Fourier matrix into the product of a few sparse matrices, the resulting factor can now be applied to a vector of the order of n log n arithmetic operations. This is the fast fourier transformed or FFT.

The fast fourier and the discrete fourier transforms are linear operation and they generate a data structure that contains log2 n segments of different lengths. The transpose of the FFT and the DWT is what is referred to as the inverse transform matrix and they can be cosine and sine, but in the wavelet domain more complex functions called wavelets, mother wavelets are formed. Both the basis viewed upon as rotation in the function space of a different domain, in the FFT this is the domain that contains the basis functions cosine and sine, but in the wavelet domain more complex functions called wavelets, mother wavelets are formed. The basis functions are functions that are localized in frequency such as power spectra useful at picking out the frequency and calculating power distributions.

A major dissimilarity between the two transforms is tat wavelet transforms are localized in space, however the Fourier sine and cosine functions are not, this feature of wavelet makes it a useful candidate in the purpose of this research, the localization feature along with wavelet localization frequency makes operations using wavelets transform 'sparse' and this is useful when used for noise removal. A major advantage of using wavelets is that the windows vary. A major application of this is to isolate signal discontinuities, a good practice is to have some very short basis functions, and at the same time to have some lone basis function in order to obtain detailed frequency analysis. A practice that is utilized is having basis functions that are of short high frequency and basis functions that are of long low frequency, point to note Is that unlike Fourier analysis that have a limited basis function sine and cosine wavelets have unlimited set of basis functions . This is a very important features allows wavelet to have access to information that can be obscured by time -frequency methods such as Fourier analysis.

Wavelets consist of different families and within each family of wavelet there exist different subclasses that are differentiated based on the coefficients that are decomposed and their levels of iteration, wavelets are mostly classified based on the number of vanishing moments, this is a mathematical relationship that is related to the number of coefficients.

## Fig above showing examples of wavelets, taken from Thesis: Speech Compression Using Wavelets by Nikhil Rao.

One of the most helpful and defining features of using wavelets is that one can actually choose the defining coefficients for any given wavelets that will be adapted to a problem or situation of interest. In Daubechies' original paper (6) specific families wavelet systems were developed that were very good in the representation of polynomial behavior' the simplest of these is the Haar wavelet. The coefficients can be thought of as being filters; these are then placed in a transformation matrix and applied to a raw data vector. The different coefficients are ordered with patterns that work as a smoothing filter and another pattern whose function is to realize the detail information of the data. The wavelet coefficient matrix is applied in a hierarchical algorithm, based on its arrangement odd rows contain the different wavelet coefficients that will act as the smoothing filter and the even rows will contain the wavelet coefficient that will act to bring out the details of the data, it is to the full length data the matrix is first applied, it is then smoothed and disseminated by half after this process the matrix is applied again, it is further smoothed and halved, this process is repeated several times until the data that remains is smoothed, what this process actually does is to bring out the highest resolutions of the data and at the same time performing data smoothing. In the removal of noise from data wavelet applications have proved very efficient and successful, as can be seen in work done by David Donoho, the process of noise removal is called wavelet shrinkage and thresholding. When data is decomposed using wavelets, actually filters are used as averaging filters while the other produce details, a few of the wavelet coefficients will correspond to details that are in the data set, and if the details are small then they can be omitted without the main features of the data set being affected. The basic idea of thresholding is setting coefficients that are at a particular threshold or less than a particular threshold to zero, these coefficients are then later used in an inverse wavelet transform to reconstruct the data set.

## Literature Review

The work done by Student Nikhil Rao and supervised by Dr. John Homer entitled "Thesis: Speech Compression Using Wavelets" was reviewed. According to the work that was done they presented a new algorithm on how to compress speech signal using discrete wavelet transform techniques. The MATLAB software version 6 was used in order to simulate and implement the codes. The steps that were taken to achieve the compression are listed below;

Choose wavelet function

Select decomposition level

Input speech signal

Divide speech signal into frames

Decompose each frame

Calculate thresholds

Truncate coefficients

Encode zero-valued coefficients

Quantize and bit encode

Transmit data frame

Based on the experiment that was conducted the Haar and Daubechies wavelets were utilized in the speech coding and synthesis the functions that were used that are a function of the MATLAB suite are as follows; dwt, wavedec, waverec, and idwt, they were used in computing the wavelet transforms. The wavedec function performs the task of signal decomposition, and the waverec function reconstructs the signal from its coefficients. The idwt function performs the inverse wavelet transform on the signal and all these functions can be found in the MATLAB software. The speech file that was analyzed was divided up into frames of 20 ms, that is 160 samples per frame and then each frame was decomposed and compressed, the file format utilized was .OD files, because of the length of the files there were able to be decomposed without being divided up into frames. The global and by-level thresholding was used in the experiment, the main aim of the global thresholding maintain the largest coefficients, regardless of the size of the wavelet decomposition tree. Using the level thresholding the approximate coefficient are kept at the decomposition level, during the process of encoding zero values are encoded with two bytes. The first byte is to specify a starting string of zeros and the other keeps track successive zeros.

The work done by Qiang Fu and Eric A. Wan "A Novel Speech Enhancement System Based On Wavelet De-noising " was also reviewed, there work was the enhancement of speech based on wavelet de-nosing framework. In their approach to their objective, the noisy speech signal was first processed using a spectral subtraction method, the aim of this first step is to remove some amount of noise from the input signal before the wavelet transform is applied. The traditional approach was then done where the wavelet transform was used in the decomposition of the speech into different levels, thresholding estimation is then on the different levels , however in this project a modified version on the Ephraim/Malah suppression rule was utilized for the thresholdign estimates. To finally enhance the speech signal the inverse wavelet transform was utilized. It was shown the pre processing of the speech signal removed small levels of noise but at the same time the distortion of the original speech signal was minimized, a generalized spectral subtraction algorithm was used to accomplish the task above this algorithm was proposed by Bai and Wan.

The wavelets transform for this approach utilized using wavelet packet decomposition, for this process a six stage tree structure decomposition approach was taken this was done using a 16-tap FIR filter, this is derived from the Daubechies wavelet, for a speech signal of 8khz the decomposition that was achieved resulted in 18 levels. The estimation method that was used to calculate the threshold levels were of a new type, the experiments took into account the standard deviation of the noise, for each level and time frame, a quantile -based noise tracking approach was utilized. A modified Ephraim/Malah suppression rule was used to achieve soft thresholdeing. The re-synthesis of the signal was done using the inverse perceptual wavelet transform and this is the very last stage.

Work done by S.Manikandan, entitled "Speech Enhancement Based on Wavelet Denosing" focuses on the reducing the content of noise present in the received wireless signal using adaptive techniques. In this project the signal of study was corrupted using white Gaussian noise. The time frequency dependent threshold approach was taken to estimate the threshold level, in this project both the hard and soft thresholding techniques were utilized in the de-noising process. As with the hard thresholding coefficient below a certain values are scaled, A general optimal universal threshold for the Gaussian white noise under 3 mean squared error criterion is used, based on the experiments that were done it was found out that this approximation is not very efficient when it comes to speech, this is mainly because of poor correlation between the subjective quality and the presence of correlated noise. A new thresholding technique was implemented in this technique the standard deviation of the noise was first estimated of the different levels and time frames. For a signal the threshold is calculated and is also calculated for each sub-band and time frame. . The soft thresholding was also implemented, with a modified Ephraim/Malah suppression rule, as seen before in the other works that were done in this are. Based on their results obtained, there was a unnatural voice pattern and to overcome this a new technique based on modification from Ephraim and Mala is implemented.

## Procedure

The procedure that undertaken involved doing several voice recording and reading the file using the 'wavread' function because the file was done in a .wav format

The length to be analyzed was decided, for the project it was taken to be the entire length of the signal

The uncorrupted signal power and signal to noise ratio (SNR) was calculated using different MATLAB functions

Additive White Gausian Noise (AWGN) was then added to the original recorded, making the uncorrupted signal now corrupted

The average power of the noise corrupted signal and the signal to noise ratio (SNR) was then calculated

Signal analysis then followed, the procedure involved in the signal analysis included:

The wavedec function in MATLAB was used in the decomposition of the signal.

The detail coefficients and approximated coefficients were then extracted and plots made to show the different levels of decomposition

The different levels of coefficient were then analyzed and compared, making detailed analysis that the decomposition resulted in

After decomposition of the different levels de-nosing took place this was done with the ddencmp function in MATLAB,

The actual de-nosing process was then undertaken using wdencmp function in MATLAB, plot comparison was made to compare the noise corrupted signal and the de-noised signal

The average power and SNR of the de-noised signal was done and comparison made between it and the original and the de-noised signal.

## Implementation/Discussion

The first part of the project consisted of doing a recording in MATLAB, a recording was done of my own voice and the default sample rate was used were Fs = 11025, the code that was used to complete the recording was y = wavrecord(n,Fs), where n represented the sample, the recording was for 9 seconds y = wavrecord(90000,Fs); the wavplay function was then used to replay the recording that was done until a desired recording was obtained after the recording was done a wavwrite function was then used to store the data that was previously recorded into a wav file. wavwrite(y,Fs,'recording1'); the data that was written into a wav file was originally stored in variable y and then given the name recording1. A plot was then made to show the wave format of the speech file recorded.

Fig 1

Fig1 Plot above showing original recording without any noise corruption

According to fig1 the maximum amplitude of the signal is +0.5 and the minimum amplitude being -0.3 from observation with the naked eye it can be seen that most of the information in the speech signal is confined between the amplitude +0.15 - -0.15.

The power of the speech signal was then calculated in MATLAB code hp = spectrum.periodogram('hamming') created a periodogram spectrum this is an estimate of the spectral density of the signal and is computed from the finite length digital sequence using the Fast Fourier Transform (FFT)the window parameter that was used was the Hamming window, the window function is some function that is zero outside some chosen interval. The hamming window is a typical window function and is applied typically by a point by point multiplication to the input of the fast fourier transform, this controls the adjacent levels of spectral artifacts which would appear in the magnitude of the fast fourier transform results, for a case where the input frequencies do not correspond with the bin center. Windowing can be considered as a convolution that takes place in the frequency domain, this is a typical multiplication in the time domain, and the outcome of this multiplication is that any samples outside a frequency will affect the overall amplitude of that frequency.

Fig2

Fig2 plot showing periodogram spectral analysis of original recording

From the spectral analysis it was calculated that the power of the signal is 0.0011 watt

power_freqdomain = avgpower(hpsd)

power_freqdomain =

0.0011

After the signal was analyzed noise was added to the signal, the noise that was added was additive gaussian white noise (AWGN), and this is a random signal that contains a flat power spectral density. At any center frequency white noise will contain equal power at a fixed bandwidth; the term white is used to mean that the frequency spectrum is continuous and is also uniform for the entire frequency band. In the project additive is used t simply mean that this impairment to the original signal is added corrupting the speech;

Based on the MATLAB code that was to generate the white noise

x = sqrt(2)*sin(0:pi/8:6*pi);

N = awgn(z,80,1,'linear');

plot (N);

The power in the signal was set to 1 watt and the SNR set to 80, the applied code was set to signal z, which is a copy of the original recording y, below is the plot showing the analysis of the noise corrupted recording.

Fig3

Fig3 plot showing the original recording corrupted by noise

Based on observation of the plot above it can be seen that information in the original recording is masked by the additive white noise to the signal, this would have a negative effect to as clean information would be masked out by the noise, a process known as aliasing. Because the amplitude of the additive noise is greater than the amplitude of the recording it causes distortion observation of the graph shows the amplitude of the corrupted signal is greater than the original recording. The noise power of the corrupted signal was calculated using the formula

noisepower = sigpower/originalSNR

noisepower =

1.3750e-005

And it was seeing that the noise power of the corrupted signal is 1.3750e-005, the spectrum peridodogram was then used to calculate the average power of the corrupted signal

power_freqdomain = avgpower(hpsd)

power_freqdomain =

0.0033

Fig4

Fig4 plot showing periodogram spectral analysis of corrupted signal

From analysis of the plot above it can be seen that the frequency of the corrupted signal spans a wider band, the original recording spectral frequency analysis showed a value of -20Hz as compared to the corrupted signal showed a value of 30Hz this increase in the corrupted signal is due to the fact that the additive noise is added and this masked out the original recording again as before the process of aliasing.

It was seen that the average power of the corrupted was greater than that of the original signal, the increase in power can be attributed to the additive noise added to the signal this caused the increase in power of the signal.

The signal to noise ratio (SNR) of the corrupted signal was calculate from the formula

corruptedSNR = corruptedpower/noisepower

corruptedSNR =

240

And was found to be 240 as compared to 472.7273 of the de-noised, the decrease in signal to noise ratio can be attributed to the additive noise this caused, this resulted in the level of noise to the level of clean recording to be greater this is the basis for the decreased SNR in the corrupted signal, the increase in the SNR in the clean signal will be discussed further in the discussion.

The reason there was a reduce in the SNR in the corrupted signal is because the level of noise to clean signal is greater and this is basis of signal to noise comparison, it is used to measure how much a signal is corrupted by noise and the lower this ratio is, the more corrupted a signal will be. The calculation method that was used to calculate this ration is

Where the different signal and noise power were calculated from MATLAB as seen above

The analysis of the signal then commenced a .wav file was then created for the corrupted signal using the MATLAB command wavwrite(N,Fs,'noise recording'); with Fs being the sample frequency, N being the corrupted file and the name being noise recording, a file x1 that was going to be analysed was created using the MATLAB command [x1] = wavread('noise recording.wav');

Wavelet multilevel decomposition was then performed on the signal x1 using the MATLAB command [C,L] = wavedec(x1,8,'db1'); the wavedec function performs the wavelet decomposition of the signal, this decomposition is a multilevel one dimensional decomposition, discrete wavelet transform (DWT) is using pyramid algorithms, during the decomposition the signal is passed through a high pass and a low pass filter. The output of the low pass is further passed through a high pass and a low pass filter and this process continues based on the specifications of the programmer, a high pass filter being a linear time invariant LTI filter that passes high frequencies well and attenuates frequency below a threshold called the cut off frequency, the rate of attenuation is specified by the designer. While on the other hand the low pass filter is the opposite to the high pass filter, this filter passes low frequency signals but attenuates signal that contain a higher frequency than the cut off. With the code above this process was done 8 times, and at each level of decomposition the actual signal is down sampled by a factor of 2. The high pass output at each stage represents the actual wavelet transformed data; these are called the detailed coefficients.

Fig 5

Fig 5 above levels decomposition

Block C above contains the decomposition vectors and Block L contains the bookkeeping vector, based on the representation above a signal X of a specific length is decomposed into coefficients, the first part of the decomposition produces 2 sets of coefficients the approximate coefficient cA1 and the detailed coefficient cD1, to get the approximate coefficient the signal x is convolved with low pass filter and to get the detailed coefficient signal x is convolved with a high pass filer. The second stage is similar only this time the signal that will be sampled is cA1 as compared to x before with the signal further being sampled through high and low pass filter again to produce approximate and detailed coefficients respectively hence the signal is down sampled by a factor of two.

The algorithm above represents the first level decomposition that was done in MATLAB, the original signal x(t) is decomposed into approximate and detailed coefficient, the algorithm above represents the signal being passed through a low pass filter where the detail coefficients are extracted to give D2(t)+D1(t) this analysis is passed through a single stage filter bank further analysis through the filter bank will produce greater stages of detailed coefficients as can be seen with the algorithm below

The coefficients,Â cAm(k)Â andÂ cDm(k)Â formÂ m = 1,2,3Â can be calculated by iterating or cascading the single stage filter bank to obtain a multiple stage filter bank.

Fig6

Fig6 showing graphical representation of multilevel decomposition

At each level it is observed the signal is down sampled by a factor of 2. At d8 it can be seen that the signal is down sampled by 2^8 i.e. 60,000/2^8. All this is done for better frequency resolution. Lower frequencies areÂ presentÂ at all time; I am mostly concerned with higher frequencies which contains the actual data.

I have used daubechies wavelet type 4 (db4), the daubechies wavelet are defined by computing the running averages and differences via scalar products with scaling signals and wavelets. For this type of wavelet there exist a balance frequency response but the phase response is non linear. The Daubechies wavelets use overlapping windows, so the high frequency coefficients spectrum reflects all high frequency changes. Based on theses properties daubechies wavelets are useful in compression and noise removal of audio signal processing.

Â For the Daubechies D4 transform, this transform has 4 wavelet types and scaling coefficient functions, these coefficient functions are shown below

The different step of the transform applies the different scaling functions to the input data, if the data set contains a value of N, the scaling function that will be applied will be applied to calculate N/2 smoothed values. The smoothed values are stored in the lower half of the N element input vector for the ordered wavelet transform. The wavelet function coefficient values are g0Â = h3 g1Â = -h2 g2Â = h1 g3Â = -h0

The different scaling function and wavelet function are calculated using the inner product of the coefficients and the four different data values. The equations are shown below:

The different iteration in the wavelet transform step is then used in the calculation of a scaling function value and the calculating of a wavelet function value. With each iteration the indexÂ iÂ is incremented by two, and a new scaling and wavelet function values calculated.

Fig 7

Diagram above showing forward transform step for the lifting scheme version for the Daubechies D4

In the diagram above the first step the split step divides the data into elements that are even, these elements are stored in the first half the N array section ( S0Â to Shalf-1) in the second half of the array ios stored the odd elements (ShalfÂ to SN-1). In the equation below that represents the forward transform the expression S[half+n] is the references for an odd element and S[n] is the references for an even element. In reality this is folded into a single function even though the diagram above goes against this, the diagrams shows two normalized steps.

The input signal in the algorithm above is then broken down into what are called wavelets. On of the major advantages of using wavelet transforms is that it contains a window that varies, to identify signal discontinuities it is best to have some very short basis functions. But in order to obtain detailed frequency analysis it is better to have long basis function. A good way to achieve this compromise is having a short high frequency functions and also long low frequency ones. Wavelet analysis contains an endless set of possible basis functions, this provides wavelet analysis with direct access to information that can be easily over looked by another time frequency methods such as Fourier analysis, for example.

The code [cD1,cD2,cD3,cD4,cD5,cD6,cD7,cD8] = detcoef(C,L,[1,2,3,4,5,6,7,8])

Is then used in order to extract the detailed coefficients the detailed coefficients that are Daubechies orthogonal type wavelets D2-D20are often used. The numbers of coefficients are represented by the index number, for every wavelet they contain a number zero moments they contain vanishing moments that are equal to the coefficients halved. This can be seen using the orthogonal types where D2 contain only one moment and D4 two moments and so on, the vanishing moment of the wavelets refers to its ability to represent the information in a signal or the polynomial behavior. The D2 type that contains only one moment will encode polynomial of one coefficient easily that are of constant signal component. The D4 type will encode polynomial of two coefficients, the D6 will encode coefficient of three polynomial and so on.

The scaling and wavelet function i.e. the low-pass filter and the high-pass filter respectively have to be normalized by a factorÂ Â . The coefficients for the wavelet are derived by the reverse of the order of the scaling function coefficients and then by reversing the sign of the second one (D4 wavelet = {-0.1830125, -0.3169874, 1.1830128, -0.6830128}) mathematically, this looks likeÂ

whereÂ kÂ is the coefficient index,Â bÂ is a wavelet coefficient andÂ cÂ a scaling function coefficient.Â NÂ is the wavelet index, ie 4 for D4.

Fig 7

Plot of fig 7 showing approximated coefficient of the level 8 decomposition

Fig 8

Plot of fig 8 showing detailed coefficient of the level 1 decomposition

Fig 9

Plot of fig 9 showing approximated coefficient of the level 3 decomposition

Fig 10

Plot of fig 10 showing approximated coefficient of the level 5 decomposition

Fig 11

Plot of fig 11, showing comparison of the different levels of decomposition

The MATLAB code below was used to generate the given plot shown above in fig 11;

subplot(2,4,1); plot(cA8);

title('Approximation cA8')

subplot(2,4,2); plot(cD1);

title('Detail cD1')

subplot(2,4,3); plot(cD2);

title('Detail cD2')

subplot(2,4,4); plot(cD3);

title('Detail cD3')

subplot(2,4,5); plot(cD4);

title('Detail cD4')

subplot(2,4,6); plot(cD5);

title('Detail cD5')

subplot(2,4,7); plot(cD6);

title('Detail cD6')

subplot(2,4,8); plot(cD7);

title('Detail cD7')

subplot(2,4,9); plot(cD8);

title('Detail cD8')

Fig12

The MATLAB code below was used to plot the details of all the levels of the coefficients;

subplot(8,1,1); plot(cD1); title('Detail Level 1'); axis off

subplot(8,1,2); plot(cD2); title('Detail Level 2'); axis off

subplot(8,1,3); plot(cD3); title('Detail Level 3'); axis off

subplot(8,1,4); plot(cD4); title('Detail Level 4'); axis off

subplot(8,1,5); plot(cD5); title('Detail Level 5'); axis off

subplot(8,1,6); plot(cD6); title('Detail Level 6'); axis off

subplot(8,1,7); plot(cD7); title('Detail Level 7'); axis off

subplot(8,1,8); plot(cD8); title('Detail Level 8'); axis off

The next step in the de-nosingprocess is the actual removal of the noise after the coefficients have been realized and calculated the MATLAB code below gives the actual noise removal algorithm

[thr,sorh,keepapp] = ddencmp('den','wv',x1);

clean = wdencmp('gbl',C,L,'db4',8,thr,sorh,keepapp)

This process actually removes noise by a process called thresholding, De-noising , the task of removing or suppressing uninformativenoise from signals, is an important part of many signal or image processing applications. Wavelets are common tools in the field of signal processing [1, 2]. The popularity of wavelets in de-nosingis largely due to the computationally efficient algorithms as well as to the sparsity

of the wavelet representation of data. By sparsity I mean that majority of the wavelet coefficients have very small magnitudes whereas only a small subset of coefficients have largemagnitudes [3]. I may informally state that this small subset contains the interesting informative part of the signal, whereas the rest of the coefficients describe noise and can be discarded to give a noise-free reconstruction.

The best known wavelet de-noising methods are thresholding approaches, see e.g. [4, 5]. In hard thresholding all the coefficients with greater magnitudes than the threshold

are retained unmodified as they are thought to comprise the informative part of data, while the rest of the coefficients are considered to represent noise and set to zero. However, it is reasonable to assume that coefficients are not purely either noise or informative but mixtures of those. To cope with this soft thresholding approaches have been proposed. In soft thresholding the coefficients with magnitudes smaller than the threshold are set to zero, but the retained coefficients are also shrunk towards zero by

the amount of the threshold value in order to decrease the effect of noise assumed to corrupt all the wavelet coefficients. In my project I have choose to do a eight level decomposition before applying the de-nosingalgorithm, The approximate sequence at the eight level is obtained by processing the original signal through eight stages of lowpass filtering. It is Therefore unnecessary to use the approximate sequence, c k L( ), in the de-nosingprocess. One assumption that we use in de-nosingis that the statistics of additive Gaussian noise is known. It is known that soft thresholding provides smoother results in comparison with the hard thresholding technique. Hard thresholding technique, however, provides better edge preservation in comparison with the soft thresholding. Based on these properties, we decided to apply the soft thresholding technique.

The actual thresholding value was calculate using MATLAB and was found to be

thr =

0.0825

For denosing some parameters have to be set. Like 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, the function ' ddencmp' gives the default threshold level and by default soft-thresholding is used .Also here 'den' means you are calculating default values for signal de-noising , above shows the default threshold value that was set from the MATALB code above.

Seeing that the speech file that was analyzed is a one dimensional signal then the MATLAB function that performs the de-nosingof this signal is the 'wdencmp' function, this function performs the de-nosingprocess using wavelets , the form that I used can be seen below;

[clean] = wdencmp('lvd',X,'wname',N,THR,SORH)

Where clean represents the final de-noised signal, but before this procedure can be done the actual thresholding value must be calculated, that is where the code

[THR,SORH,KEEPAPP] = ddencmp(IN1,'wv',X)

Comes in, the function ddencmp gives the default values for the de-nosingprocess that will be needed later, in the case of my project for de-nosingthe variable IN1 is set to 'den' for the de-nosingpurpose, the variable 'wv' wavelet and 'x' being the signal.

The variable THR represents thresholding, SORH represents soft thresholding and the variable KEEPAPP allows the approximate coefficients to be kept, all the values I obtained from MATLAB can be seen below;

>> thr

thr =

0.0825

>> sorh

sorh =

s

>> keepapp

keepapp =

1

Fig 13

Plot of fig 3 showing de-noised signal after wavelet thresholding and denosing algorithm was performed.

Fig 14

Plot of Fig 14 showing comparison of the original signal vs de-noised signal

The MATLAB code below was used to generate the plot shown in figure 14

subplot(2,1,1); plot(y); title('original')

subplot(2,1,2); plot(clean); title('de-noised')

Fig15

Plot of fig 15 showing the comparison of the de-noised signal and noisy signal

The MATLAB code below was used to generate the plot shown above

subplot(2,1,1); plot(clean); title('de-noised')

subplot(2,1,2); plot(x1); title ('noisy')

From the plots shown above fig13-fig15 it can be seen that there is significant difference between the noisy signal as compared to the de-noised and original, it can be seen that the amount of distortion in the de-noised signal is a lot less as compared to the noisy signal based on pure observation to quantify these observations the signal to noise ration calculated for both can be observed

cleanSNR = cleansigpower/noisepower

cleanSNR =

472.7273

corruptedSNR = corruptedpower/noisepower

corruptedSNR =

240

It can be seen that the signal to noise ratio of the de-noised signal is greater than that of the corrupted signal, based on these results the de-noised signal the level of noise in the signal is less as a greater signal to noise ratio indicates less corruption in the signal. The results indicate there is a greater level of signal power than noise power in the de-noised signal, the de-nosing algorithm showed a vast improvement in the signal to noise ratio.

Several similar recordings where done with different noise power and noise SNR used and in the de-noising process several different decompositions levels were also used as well as the Daubechies filter type used, the other procedures that were used are similar to the original procedure main difference is the variables that were chosen, below shows graphs and calculations for several different de-noised recordings.

Fig16

Plot above showing comparison of the 3rd recording and de-noising process that was done

The graph above shows the results obtained after the de-noising procedure using wavelet transform was applied to the noise corrupted signal. The procedures used to generate the signal and the noise is similar to the procedures above, in the de-noising process Daubechies wavelet type 8 was used and only 5 levels of decomposition was done, the thresholding value that was used in this de-noising process was 0.0580, based on the calculations done in MATLAB the corrupted SNR was calculated to be 227.1 and the clean SNR calculated to be 361.3 based on these calculations it can be seen that there was some cleansing of the noise corrupted signal after the wavelet thresholding procedure was performed. Based on observation of the clean signal it is evident that de-noising process was successful.

A fourth recording was done with similar properties to the recordings above, however the Daubechies type 10 filter was used and a similar 5 level decomposition was used because this signal was a different recording the signal power and SNR of the corrupted signal was different, when the de-nosing procedure was applied a threshold value of 0.1000 was used and this threshold was used as a variable to calculate the clean signal, based on calculations in MATLAB the SNR of the corrupted and clean signals were compared, the SNR was found to be 1.2212e+003 and 3.2692e+003 respectively the improvement in the SNR after the de-noising procedure showed the improvement of the signal quality, below is a graph showing comparison of the signals form the forth recording.

Fig 17

Plot above showing comparison of the 4th recording and de-noising process that was done

The MATLAB function wden was also used in the de-nosing process to produce a separate de-noised signal , de-noised2 the MATLAB code that was used in this de-nosing process can be seen below

denoised2 = wden(N,'minimaxi','s','sln',8,'db4');

The wden function is a one dimensional de-noising function, it performs an automatic de-noising process. The format that was used is shown [XD,CXD,LXD] = wden(X,TPTR,SORH,SCAL,N,'wname')

The code will result in a de-noised signal XD from the input signal X by thresholding wavelet coefficients. The TPTR function that was used in my program was minimaxi this function uses a fix threshold to yield minimax performance. The minimax function is designed to realize the minimum of the maximum mean square error obtained for the worst function in a given set. The variable SHOR that I choose to use is 's' for soft thresholding as it yields better results as compared to hard thresholding where it was evident that the signal still contained audible noise in the output signal. The variable for the function SCAL that I used in my program was 'sln' this function is for rescaling using a single estimation based on the level of noise and the first level coefficients.

Fig18

Plot above showing comparison of the 5th recording and de-noising process that was done

Based on the plot above it can be seen that the signal resembles the original denoised signal, but based on empirical information the signal that is reproduced by this procedure yields better results, the noise level is less as can be proven by the signal to noise ratio

denoised5SNR = denoised5sigpower/noisepower

denoised5SNR =

160.1635

Which is seen to be greater that the original denoised signals, the results indicate there is a greater level of signal power than noise power in the de-noised2 signal, as compared to the original denoised signal, based on observation of listening to both de-noised signals it could be heared that there was vast improvement in the SNR and the quality of the signal as noised was removed from the signal through wavelet thresholding and de-noising.

Wavelet packet transform was also analyzed and used in the de-noising process as oppose to wavelet transforms, the main difference between the wavelet transform and the wavelet packet transform is that in the packet transform the signal is passed through more filters as compared to its DWT counterpart, in the wavelet packet transform the level s are calculated by the decomposition of both detailed and approximated coefficients. With the wavelet packet transform the decomposition produces 2nÂ sets of different coefficients, however with the sampling process the coefficients remains the same as compared to the DWT. The same sampling rate was used as before and the speech file almost identical the same matlab codes were used in simulating this.

Fs = 11025;

y = wavrecord(90000,Fs);

wavplay(y,Fs);

wavwrite(y,Fs,'recording2');

plot(y);

z = y;

White noise was then added of exactly the same properties as before and the MATLAB code used to simulate this is identical to procedure above. However the decomposition function that was used was different from that used in the wavelet transform the function used was 'wpdec', that actual code that was used in the decomposition process is shown below;

T = wpdec(N,8,'db4','shannon')

Fig. 16

Plot above of fig 16 showing WP decomposition.

The code shown above provides a WP tree that corresponds the the WP decomposition at 8 levels to the noise corrupted signal N. the coefficients were then realized using the function 'wpcoef' this function gives the coefficients that are associated with the input signal N, of the WP tree shown above T.

[thr,sorh,keepapp,crit] = ddencmp('den','wp',Coeff);

The MATLAB code above was then used to realized the denoising variables and the threshold value that was used was 0.3500, this code is almost identical to the codes used in wavelet transform above however it acts on WP instead. Based on the vales obtained the clean signal was realized using the MATLAB code;

clean = wpdencmp(Coeff,'s',8,'db4',crit,thr,keepapp);

Again the code used is almost identical to that used above. Below are diagrams showing original vs. noisy vs. clean recordings

Fig 17

Fig 17 above showing comparison of the original, noisy and denoised signal as a result of WP transform

Based on the signal to noise ratio that was calculated in MATLAB it was proved that the WP analysis actually performed the de-noising function it was intended to do the SNR of the de-noised signal being higher than the SNR of the noise corrupted signal as shown below;

corruptedSNR =

89.3694

clean2SNR =

278.9189

The increase in the SNR of the de-noised signal actually proved that it contains more information than corrupted noise the SNR was calculated based on the signal powers as calculated above.

## Conclusion

The proposed method constitutes a successful application of the wavelet thresholding for speech enhancement. The aim of the project was to enhance speech signal by using wavelet thresholding, the software that was used in the simulation was MATLAB v7.0, MATLAB is a very powerful mathematical software and was efficient in the performing the objectives of the project, on comparison of both corrupted signal, corrupted with white noise and the denoised signal it can be seen that there is drastic improvement in the quality of the denoised signal and improvement in the SNR of the signal.

The procedures that were employed in this project were sufficient enough to provide efficient denoising of the signal, further research that was done revealed that if wavelet packets were used there could have been greater clarity and improvement in the output signal. The procedure that was done to remove the noise and improve the SNR is outlined below;

Choose wavelet function

Select decomposition level

Input speech signal

Divide speech signal into frames

Decompose each frame

Calculate thresholds

Perform de-noising

The daubechies 4 wavelet type was used and compared to the other types gave the better results in terms of output signal quality and SNR.

Based on the experiments done it could be proven that the wavelet tree is built recursively, with this process the decomposition and approximation only to the mother wavelet. In the experiments different thresholding values where used and compared and the value that gave the best denoised output based on the graphs and calculation of the SNR was choosed

Based on the experiments conducted a comparison was done and its was proved that using the wavelet packet thresholding and analysis as compared to the wavelet thresholding the WPT actually provided better signal de-noising as compared to the WT, the fact that using the WPT the signal is passed through more filters this act to provide better smoothing and de-noising of the signal the improvement in SNR also proved this observation. Using wavelet packets filters are applied to both the approximated and decomposition filter output.

Wavelets are a powerful tool to analyze signals and by splitting up the signals into sub-bands and then analyzing each individual signals independently based on their time and frequency component useful information can be gathered and this proved efficient and helpful in the de-noising process.