フィルターのクリア

Filtering out high frequency noise of an audio file

6 ビュー (過去 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 Center および File ExchangeMeasurements and Spatial Audio についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by