I want to remove noise from my audio signal by simplest method?

6 views (last 30 days)
I have a simple audio signal to which I added noise by gauasian method. Now I want to remove the noise and want my signal to be the same as without noise. I have tried using wiener filter but that isn't working. Would someone please make any filter to reslove this or help me.
Code is:
%% simulate noisy signal
[combined] = audioread('music.wav');
x = combined ;
sound(x);
% add noise to the signal
Mean=0.00;
Var=0.001;
z=imnoise(x,'Gaussian',Mean,Var);
noise_remove = wiener2(z);
sound(noise_remove);
% plot the orignal signal
subplot(2,2,1);
plot(x);
title('orignal');
xlabel('Time (s)');
ylabel('Amplitude');
% plot the noisy signal
subplot(2,2,2);
plot(z);
title('Noisy Signal');
xlabel('Time (s)');
ylabel('Amplitude');
% plot the filtered signal
subplot(2,2,3);
plot(noise_remove);
title('filtered signal');
xlabel('Time (s)');
ylabel('Amplitude');

Answers (3)

Dev
Dev on 28 May 2025
Hi @usman,
In the code provided in the question, the Wiener filter used (“wiener2”) to remove Gaussian noise from an audio signal is designed for 2D images, not 1D audio signals. I believe that is why it is not working as expected.
Also, the code adds noise using “imnoise”, which is more suitable for images. Instead, we can add noise manually using the “randn” function in MATLAB.
To filter the signal, we can write our own custom filter using MATLAB code. I have attached a code snippet below for your reference which implements noise removal using a custom filter–
% Use moving average or lowpass filter
filtered_signal = medfilt1(z, 5); % Median filter
% Or
filtered_signal = lowpass(z, 0.1, fs); % Low-pass filtering
sound(filtered_signal, fs);
I have also attached a screenshot below for your reference which shows the original signal, noisy signal and the signal after noise removal (filtered signal).
For more information regarding the MATLAB functions discussed above, please refer to the relevant documentation links below-
I hope the above explanation helps answer your question.

Walter Roberson
Walter Roberson on 29 May 2025
Suppose you have an input signal that starts with 0.1 and 0.2. Suppose you add noise to the third sample onwards, and after adding the noise, the noisy third sample is 0.3. Given this 0.1, 0.2, 0.3 vector, reconstruct the original third sample.
We know that the input signal was in the range -1 to +1. We might possibly know that the noise is in the range -1 to +1. We know that the result of adding the noise was 0.3 .
We can deduce from the upper limit on the input signal being 1.0, that the noise was at least -0.7 -- input signal 1.0, noise -0.7, total output 0.3.
We can deduce from the lower limit on the input signal being -1.0 that the noise would have to be higher than 1.0 to reach 0.3, so we can deduce that the input signal was at least -0.7 -- input signal -0.7, noise +1.0, total output 0.3.
So we have constrained the noise to be in the range -0.7 to +1.0 .
We can probably also constrain the input signal at that location.
But... can we do more than this? Can we identify exactly what the original input signal is, knowing only the noise-added result?
The answer is NO. The input signal might have been -0.7 and the noise might have been +1.0; the input signal might have been -0.55 and the noise might have been 0.75; the input signal might have been 0.89 and the noise might have been -0.59 . Unless we know the original input signal at that point, or we know the exact noise at that point, we are unable to reconstruct the original signal exactly
and want my signal to be the same as without noise.
You cannot do that, at least not without knowing the exact noise profile.

Image Analyst
Image Analyst on 29 May 2025
For the simplest (but not necessarily the best or most accurate) try sgolayfilt() or movmean().
Is your combined a 1-D mono signal or a 2-D stereo signal?

Categories

Find more on Audio Processing Algorithm Design 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!