How to remove noise from a certain frequency using FFT

I would like to know how to remove noises at a certain frequency using only the code below. Don't worry I have attached the sound file in the above so you use it. The problem I am facing is that I do not know how to do to find the index for this array to help cancel out all the noise greater than 3500 Hz or in this case the freq = 3500. I have the question of the code in here as well.
clear;
close all;
clc;
[y, Fs] = audioread('unfiltered_sound.wav');
dt = 1/Fs;
N = length(y(:,1));
nu_Ny = 1/(2*dt);
nu = linspace(0, 2*nu_Ny, N);
f = Fs*(0:(N/2))/N;
F = fft(y);
figure(1);
plot(nu, abs(F))
freq = 3500;
[~, ind] = min(abs(f-freq));
F_filtered = F;
F_filtered(ind:end-ind) = zeros(length([F_filtered(ind:end-ind)]),1);
%
figure(2)
plot(nu, abs(F_filtered))
%
y_filtered = ifft(F_filtered);
%
audiowrite('filtered_sound.wav', y_filtered, Fs)

6 comentarios

Sindar
Sindar el 20 de Sept. de 2020
I don't see the problem. You calculate an index. Does that not work?
Nope it came out weird as heck as. It doesn't seem to filter out the right sound for it
does the frequency-domain plot look correct?
plot(nu, abs(F_filtered))
Looks like someone whispering LMAO
Sindar
Sindar el 21 de Sept. de 2020
what about compared to the original signal? Does it look like it is filtering the right area? If not, my first guess would be that 'f' and 'nu' are not consistent (or at least, not what you expect)
nope it does not

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Preguntada:

el 20 de Sept. de 2020

Comentada:

el 21 de Sept. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by