MATLAB Answers

How do I remove background noise from a sound wave?

조회 수: 484(최근 30일)
David Koenig
David Koenig 17 Nov 2013
답변: pravin m 5 Nov 2019
I have a sound wave y(1:441000) gathered using a microphone and I have background n(1:441000) also gathered by the microphone. I have tried removing the background noise using a script something like:
Y=fft(y);
N=fft(n);
Yclean=Y-N;
yClean=ifft(Yclean);
However, yClean is not correct and is backwards in time. Do you have any suggestions?
Thanks,
Dave

  댓글 수: 0

댓글을 달려면 로그인하십시오.

채택된 답변

Pedro Villena
Pedro Villena 18 Nov 2013
Create and Implement LMS Adaptive Filter to remove the filtered noise from desired signal
mtlb_noisy = y;
noise = n;
% Define Adaptive Filter Parameters
filterLength = 32;
weights = zeros(1,filterLength);
step_size = 0.004;
% Initialize Filter's Operational inputs
output = zeros(1,length(mtlb_noisy));
err = zeros(1,length(mtlb_noisy));
input = zeros(1,filterLength);
% For Loop to run through the data and filter out noise
for n = 1: length(mtlb_noisy),
%Get input vector to filter
for k= 1:filterLength
if ((n-k)>0)
input(k) = noise(n-k+1);
end
end
output(n) = weights * input'; %Output of Adaptive Filter
err(n) = mtlb_noisy(n) - output(n); %Error Computation
weights = weights + step_size * err(n) * input; %Weights Updating
end
yClean = err;

  댓글 수: 1

Tahira Batool
Tahira Batool 30 Apr 2017
And what if one does not have a separate noisy signal to be removed from an original signal ,then how can we remove background noise from a signal?

댓글을 달려면 로그인하십시오.

추가 답변(3개)

Umair Nadeem
Umair Nadeem 18 Nov 2013
It would be easier if you could upload the noisy signal too. Save the variable y which supposedly has the noisy signal in a .mat file using save command and attach it with your post. Some frequency analysis could be done if the signal is available.
Also try to provide info about the signal frequency (if known), and the sampling frequency which you used to sample the data.

  댓글 수: 0

댓글을 달려면 로그인하십시오.


pinreddy chaitanya
pinreddy chaitanya 22 Oct 2018
편집: Walter Roberson 22 Oct 2018
weights = weights + step_size * err(n) * input; %Weights Updating
what is the use of this line

  댓글 수: 1

Albin Lindmark
Albin Lindmark 8 Jul 2019
It is to update the weights of the adaptive filter.

댓글을 달려면 로그인하십시오.


pravin m
pravin m 5 Nov 2019
mtlb_noisy = y;
noise = n;
% Define Adaptive Filter Parameters
filterLength = 32;
weights = zeros(1,filterLength);
step_size = 0.004;
% Initialize Filter's Operational inputs
output = zeros(1,length(mtlb_noisy));
err = zeros(1,length(mtlb_noisy));
input = zeros(1,filterLength);
% For Loop to run through the data and filter out noise
for n = 1: length(mtlb_noisy),
%Get input vector to filter
for k= 1:filterLength
if ((n-k)>0)
input(k) = noise(n-k+1);
end
end
output(n) = weights * input'; %Output of Adaptive Filter
err(n) = mtlb_noisy(n) - output(n); %Error Computation
weights = weights + step_size * err(n) * input; %Weights Updating
end
yClean = err;

  댓글 수: 0

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by