Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
136 views

MATLAB Code of The Project

The MATLAB code loads an audio file, adds artificial noise like additive white Gaussian noise (AWGN) or traffic/airplane noise to corrupt the signal, and then uses an adaptive filter (LMS algorithm) to remove the noise and recover the original clean signal. It plays the original, noisy, and filtered signals and plots the signals and error at each step to analyze the effectiveness of the noise removal process. The code performs this process for adding and removing AWGN noise, traffic noise, and airplane noise from the voice signal.

Uploaded by

asefash misganaw
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
136 views

MATLAB Code of The Project

The MATLAB code loads an audio file, adds artificial noise like additive white Gaussian noise (AWGN) or traffic/airplane noise to corrupt the signal, and then uses an adaptive filter (LMS algorithm) to remove the noise and recover the original clean signal. It plays the original, noisy, and filtered signals and plots the signals and error at each step to analyze the effectiveness of the noise removal process. The code performs this process for adding and removing AWGN noise, traffic noise, and airplane noise from the voice signal.

Uploaded by

asefash misganaw
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

MATLAB code for voice signal with AWGN

%Code for audio with AWGN Noise


load handel.mat;
d= 'IsThat.mp3';
samples = [1,28*Fs];
clear d Fs
[d,Fs] = audioread('IsThat.mp3',samples);
sound(d,Fs)
pause(13)
x=awgn(d,20);
sound(x,Fs)
pause(3)
mu=0.013
ha=adaptfilt.lms(256,mu);
[y,e]=filter(ha,x(:,1),d(:,1));
sound(y,Fs)
subplot(4,1,1)
plot(d)
grid on
xlabel('iterations')
ylabel('amplitude')
title('original voice signal')
subplot(4,1,2)
plot(x)
grid on
xlabel('iterations')
ylabel('amplitude')
title('signal with AWGN')
subplot(4,1,3)
plot(y)
grid on
title('filtered output')
xlabel('iterations')
ylabel('amplitude')
subplot(4,1,4)
plot(e)
grid on
title('error signal')
xlabel('iterations')
ylabel('amplitude')
MATLAB code for voice signal with traffic noise
% Code for audio with traffic noise
load handel.mat;
d = 'IsThat.mp3';
samples = [1,50*Fs];
clear d Fs
[d,Fs] = audioread('IsThat.mp3',samples);
sound(d,Fs)
pause(12)
[n,Fs]= audioread('traffic-10.mp3',samples);
x=d+n;
sound(x,Fs)
pause(8)
mu=0.0130
ha=adaptfilt.lms(256,mu);
[y,e]=filter(ha,x(:,1),d(:,1));
sound(y,Fs)
subplot(4,1,1)
plot(d)
grid on
xlabel('Iterations')
ylabel('Amplitude')
title('Original Signal')
subplot(4,1,2)
plot(x)
grid on
xlabel('Iterations')
ylabel('Amplitude')
title('Signal with traffic noise')
subplot(4,1,3)
plot(y)
grid on
xlabel('Iterations')
ylabel('Amplitude')
title('Filtered signal')
subplot(4,1,4)
plot(e)
grid on
xlabel('Iterations')
ylabel('Amplitude')
title('Error signal')
MATLAB code for voice signal with airplane noise
% Code for audio with airplane noise
load handel.mat;
d = 'IsThat.mp3';
samples = [1,50*Fs];
clear d Fs
[d,Fs] = audioread('IsThat.mp3',samples);
sound(d,Fs)
pause(12)
[n,Fs]= audioread('hJetEng.mp3',samples);
x=d+n;
sound(x,Fs)
pause(8)
mu=0.0130
ha=adaptfilt.lms(256,mu);
[y,e]=filter(ha,x(:,1),d(:,1));
sound(y,Fs)
subplot(4,1,1)
plot(d)
grid on
xlabel('Iterations')
ylabel('Amplitude')
title('Original Signal')
subplot(4,1,2)
plot(x)
grid on
xlabel('Iterations')
ylabel('Amplitude')
title('Signal with airplane noise')
subplot(4,1,3)
plot(y)
grid on
xlabel('Iterations')
ylabel('Amplitude')
title('Filtered signal')
subplot(4,1,4)
plot(e)
grid on
xlabel('Iterations')
ylabel('Amplitude')
title('Error signal')
load handel.mat;
d = 'IsThat.mp3';
samples = [1,50*Fs];
clear d Fs
[d,Fs] = audioread('IsThat.mp3',samples);
sound(d,Fs)
pause(12)
[n,Fs]= audioread('hJetEng.mp3',samples);
x=d+n;
sound(x,Fs)
pause(8)
mu=0.0130
load handel.mat;
d = 'IsThat.mp3';
samples = [1,50*Fs];
clear d Fs
[d,Fs] = audioread('IsThat.mp3',samples);
sound(d,Fs)
pause(12)
[n,Fs]= audioread('hJetEng.mp3',samples);
x=d+n;
sound(x,Fs)
pause(8)
mu=0.0130

You might also like