Removing random noise from audio signal
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, guys below are my code .. I am a newbie in Matlab and in my code audio file I add random noise in my audio file and after adding it I want to design a filter which removes that noise. Any hint or comment will be helpful to me. I also attached the audio file. Thanks
clear
close all
clc
[x,fs] = audioread('D.wav');
whos x; % Name Size Bytes Class sampling frequency
% x 556542x2 8904672 double 44100
% pOrig = audioplayer(x,fs);
% pOrig.play;
N = size(x,1); % Determine total number of samples in audio file
figure;
subplot(2,1,1);
stem(1:N, x(:,1));
title('Left Channel');
subplot(2,1,2);
stem(1:N, x(:,2));
title('Right Channel');
pause
%Adding Noise in audio signal
y=x;
y = y + randn(size(y));
% pOrig = audioplayer(y,fs);
% pOrig.play;
figure;
subplot(2,1,1);
stem(1:N, y(:,1));
title('Left Channel with Noise');
subplot(2,1,2);
stem(1:N, y(:,2));
title('Right Channel with Noise');
%nyquist frequncy = fs/2;44100/2=22050
%plot the spectrum
df = fs/N;
w = (-(N/2):(N/2)-1)*df;
y1= fft(y(:,1),N)/N;
y2 = fftshift(y1);
figure;
plot(w,abs(y2));
pause
n = 7;
beginFreq = 50 / (fs/2);
endFreq = 150 / (fs/2);
[b,a] = butter(n, [beginFreq, endFreq], 'stop');
fout = filter(b,a,y2);
% A = audioplayer(fout,fs);
% pOrig.play;
figure;
plot(b,a);
6 comentarios
Ameer Hamza
el 6 de Dic. de 2020
I am looking for zip file, and it does seem to be present here. Kindly someone mention here
Respuestas (2)
harsini j
el 19 de Ag. de 2019
clear
close all
clc
[x,fs] = audioread('D.wav');
whos x; % Name Size Bytes Class sampling frequency
% x 556542x2 8904672 double 44100
% pOrig = audioplayer(x,fs);
% pOrig.play;
N = size(x,1); % Determine total number of samples in audio file
figure;
subplot(2,1,1);
stem(1:N, x(:,1));
title('Left Channel');
subplot(2,1,2);
stem(1:N, x(:,2));
title('Right Channel');
pause
%Adding Noise in audio signal
y=x;
y = y + randn(size(y));
% pOrig = audioplayer(y,fs);
% pOrig.play;
figure;
subplot(2,1,1);
stem(1:N, y(:,1));
title('Left Channel with Noise');
subplot(2,1,2);
stem(1:N, y(:,2));
title('Right Channel with Noise');
%nyquist frequncy = fs/2;44100/2=22050
%plot the spectrum
df = fs/N;
w = (-(N/2):(N/2)-1)*df;
y1= fft(y(:,1),N)/N;
y2 = fftshift(y1);
figure;
plot(w,abs(y2));
pause
n = 7;
beginFreq = 50 / (fs/2);
endFreq = 150 / (fs/2);
[b,a] = butter(n, [beginFreq, endFreq], 'stop');
fout = filter(b,a,y2);
% A = audioplayer(fout,fs);
% pOrig.play;
figure;
plot(b,a);
0 comentarios
harinie Jr
el 5 de Oct. de 2020
clear
close all
clc
[x,fs] = audioread('D.wav');
whos x; % Name Size Bytes Class sampling frequency
% x 556542x2 8904672 double 44100
% pOrig = audioplayer(x,fs);
% pOrig.play;
N = size(x,1); % Determine total number of samples in audio file
figure;
subplot(2,1,1);
stem(1:N, x(:,1));
title('Left Channel');
subplot(2,1,2);
stem(1:N, x(:,2));
title('Right Channel');
pause
%Adding Noise in audio signal
y=x;
y = y + randn(size(y));
% pOrig = audioplayer(y,fs);
% pOrig.play;
figure;
subplot(2,1,1);
stem(1:N, y(:,1));
title('Left Channel with Noise');
subplot(2,1,2);
stem(1:N, y(:,2));
title('Right Channel with Noise');
%nyquist frequncy = fs/2;44100/2=22050
%plot the spectrum
df = fs/N;
w = (-(N/2):(N/2)-1)*df;
y1= fft(y(:,1),N)/N;
y2 = fftshift(y1);
figure;
plot(w,abs(y2));
pause
n = 7;
beginFreq = 50 / (fs/2);
endFreq = 150 / (fs/2);
[b,a] = butter(n, [beginFreq, endFreq], 'stop');
fout = filter(b,a,y2);
% A = audioplayer(fout,fs);
% pOrig.play;
figure;
plot(b,a);
0 comentarios
Ver también
Categorías
Más información sobre Audio Processing Algorithm Design en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!