how to remove noise from audio using fourier transform and filter and to obtain back the original audio signal
21 views (last 30 days)
Show older comments
[y,Fs]=audioread('audio.wav');
%Normal sound
sound(y,Fs);
subplot(3,1,1);
plot(y);
x=y(1:2:length(y));%x=y(1:2:end)
%Decimated sound
sound(x,Fs);
subplot(3,1,2);
plot(x);
xn=randn(384362,1);
yn=y+xn;
sound(yn,Fs);
x1(1)=y(1);
g=length(y)-1;
j=2;
i=2;
while g~=0
m=rem(i,2);
if m==0
x1(i)=0;
else
x1(i)=y(j);
j=j+1;
g=g-1;
end
i=i+1;
end
%Interpolated sound
sound(x1,Fs);
subplot(3,1,3);
plot(x1);
srate = 10000;
time = 0:1/srate:2;
npnts = length(time);
% signal
signal = y;
% Fourier spectrum
signalX = fft(signal);
hz = linspace(0,srate/2,npnts);
% amplitude
ampl = abs(signalX(1:length(hz)));
figure(1);
stem(signal);
figure(2), clf
stem(hz,ampl,'ks-','linew',3,'markersize',10,'markerfacecolor','w')
% make plot look a bit nicer
set(gca,'xlim',[0 10])
xlabel('Frequency (Hz)'), ylabel('Amplitude (a.u.)')
0 Comments
Answers (2)
Suhan
on 22 Feb 2018
Hi,
The following documentation demonstrates discarding noise from the data using 'fft': https://in.mathworks.com/help/matlab/math/fourier-transforms.html
Once you discard the noise spectrum, you can use 'ifft' to recover the signal. For 'ifft' refer to the following: https://in.mathworks.com/help/matlab/ref/ifft.html
Manideep
on 4 Aug 2024
matlab code on echo noise cancellation in trigonometric forrier series
0 Comments
See Also
Categories
Find more on Measurements and Spatial Audio 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!