Filtering out high frequency noise of an audio file

6 次查看(过去 30 天)
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