Filtering out high frequency noise of an audio file
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Arquelau
el 13 de Dic. de 2016
Respondida: Star Strider
el 13 de Dic. de 2016
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.
0 comentarios
Respuesta aceptada
Star Strider
el 13 de Dic. de 2016
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Measurements and Spatial Audio 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!