필터 지우기
필터 지우기

Removing random noise from audio signal

조회 수: 7 (최근 30일)
Ali Khan
Ali Khan 2018년 1월 18일
댓글: Jan 2020년 12월 6일
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
Ameer Hamza
Ameer Hamza 2020년 12월 6일
I am looking for zip file, and it does seem to be present here. Kindly someone mention here
Jan
Jan 2020년 12월 6일
For which zip file are you looking?

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

답변 (2개)

harsini j
harsini j 2019년 8월 19일
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);

harinie Jr
harinie Jr 2020년 10월 5일
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);

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by