Coding noise cancellation in matlab
126 views (last 30 days)
Show older comments
%This is a program I found online. It's supposed to take an audio file from the folder, add noise and then filter it out. However, ha=dsp.LMSFilter(256,mu); is wrong and how to add the correct arguments to dsp.LMSFilter(), I have no idea. Alos, I don't understand the working of the code. Any help would be appreciated. This is a part of a very important and graded project in my college.
load handel.mat;
d= 'Recording.m4a';
samples = [1,20*Fs];
clear d Fs
[d,Fs] = audioread('Recording.m4a',samples);
sound(d,Fs)
pause(3)
x=awgn(d,20);
sound(x,Fs)
pause(3)
mu=0.017;%stepsize
ha=dsp.LMSFilter(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')
4 Comments
Answers (1)
Asvin Kumar
on 3 Oct 2019
Consider using either of the following syntaxes:
ha=dsp.LMSFilter('Length',256,'StepSize',mu);
ha=dsp.LMSFilter(256,'StepSize',mu);
For more details have a look at the following example:
For more details on the syntax for object creation and object properties refer to:
0 Comments
See Also
Categories
Find more on Propagation and Channel Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!