Filtering out high frequency noise of an audio file
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Star Strider
il 13 Dic 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Measurements and Spatial Audio in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!