필터 지우기
필터 지우기

Filtering out high frequency noise of an audio file

조회 수: 4 (최근 30일)
Arquelau
Arquelau 2016년 12월 13일
답변: Star Strider 2016년 12월 13일
Hi,
I have an audio that consists of a human voice with a high frequency noise in the background and I want to filter out the noise. Below is the code, in which I use an ideal low pass filter:
rect = @(x) 0.5*(sign(x+0.5) - sign(x-0.5)); % function used in the ideal filter
[audioIN,fs] = audioread('agudo.m4a');
[numSamples, channels] = size(audioIN);
audioIN = audioIN(:,1);
Ts = 1/fs;
t = 0:Ts:(numSamples-1)*Ts;
fscale = -fs/2:1/max(t):fs/2;
plot(t,audioIN);title('input audio (time domain)');
fftM = fft(audioIN);
fftM = fftshift(fftM);
fftM = abs(fftM);
figure;
plot(fscale,fftM);title('input audio (freq domain)');
filter = rect(fscale/(2*3000));
figure;
plot(fscale,filter);title('filters transfer function');
fftM = fftM.*filter';
figure;
plot(fscale,fftM);title('output audio (freq domain)');
audioOUT = ifft(fftM);
audioOUT = ifftshift(audioOUT);
audioOUT = abs(audioOUT);
audioOUT = audioOUT./max(abs(audioOUT));
figure;
plot(t,audioOUT);title('output audio (time domain)');
filename = 'filtrado.m4a';
audiowrite(filename, audioOUT, fs);
However, in the output, I am not getting what I was expecting (human voice with no noise): I can only hear some random noise (not the high frequency noise of the input audio file).
Can anybody help me? Many thanks.

채택된 답변

Star Strider
Star Strider 2016년 12월 13일
Human speech is essentially band-limited to be about 100-6000 Hz. Probably the easiest way to filter your signal is to use bandpass filter with * 50 Hz and 6100 Hz stopband. Use the Signal Processing Toolbox designfilt function to design it. Use the freqz function to be certain it does what you want it to, and the filtfilt function to do the actual filtering.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by