How to Identify Range of Frequency which is Noise from FFT Freq Domain graph

15 views (last 30 days)
[x, Fs] = audioread('vuvuzela.mp3');
y = filter(LowPass5k,x);
sound(y, Fs);
audiowrite('vuvuzela_filtered.wav', y, Fs);
function Hd = LowPass5k
%LOWPASS5K Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.11 and Signal Processing Toolbox 8.7.
% Generated on: 25-Apr-2022 10:43:16
% Elliptic Bandstop filter designed using FDESIGN.BANDSTOP.
% All frequency values are in Hz.
Fs = 48000; % Sampling Frequency
Fpass1 = 1700; % First Passband Frequency
Fstop1 = 2000; % First Stopband Frequency
Fstop2 = 11000; % Second Stopband Frequency
Fpass2 = 12000; % Second Passband Frequency
Apass1 = 1; % First Passband Ripple (dB)
Astop = 80; % Stopband Attenuation (dB)
Apass2 = 1; % Second Passband Ripple (dB)
match = 'passband'; % Band to match exactly
% Construct an FDESIGN object and call its ELLIP method.
h = fdesign.bandstop(Fpass1, Fstop1, Fstop2, Fpass2, Apass1, Astop, ...
Apass2, Fs);
Hd = design(h, 'ellip', 'MatchExactly', match);
end
% [EOF]
This is the main file . Link to vuvuzela.mp3
[x, Fs] = audioread ('vuvuzela.mp3');
N = length(x);
Ts = 1/Fs;
tmax = (N-1)*Ts;
t =0:Ts:tmax;
plot(t, x)
f = -Fs/2 : Fs/(N-1) : Fs/2;
z = fftshift(fft(x));
plot(f, abs(z))
xlabel('Frequency');
ylabel('Power');
[y, Fs] = audioread ('vuvuzela_filtered.wav');
figure
plot(t, y)
Yk = fftshift(fft(y));
plot(f, abs(Yk))
xlabel('Frequency');
ylabel('Power');
This is the FFT file
This is the FFT Freq domain graph of NOISY signal x. I am not able to identify which range of frequency is the noise. I trial and error different ranges using different filters (LP, BP, BS). When I play the sound, almost everytime I can hear the noise and the message. Its like got no difference even after filtering. Its seems every range of frequency has noise.

Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 25 Apr 2022
Your filtered signal is not quite noise free as it shows here from your script, and your obtained FFT is not quite correct.
[x, Fs] = audioread('vuvuzela.mp3');
N = length(x); % Length of the read signal
t = (0:N-1)/Fs; % Time domain range for audio
dt = (t(2)-t(1)); % time step or simply dt = t(2)
Fhat = fft(x,N); % FFT
PSD = Fhat.*conj(Fhat)/N; % Power spectrum
freq = 1/(dt*N)*(0:N); % Frequency
L=1:floor(N/2);
Ind = PSD>5; % Find all freqs with large power
PSD_clean = PSD.*Ind;
Fhat=Ind.*Fhat;
F_filtered = ifft(Fhat); % Inverse FFT for filtered time signal
plot(t,x, 'bx', t, F_filtered, 'r', 'linewidth', 2)
legend('Noisy signal', 'Cleaned signal')
figure
Y1 = fftshift(fft(x));
Y2 = fftshift(fft(F_filtered));
plot(freq(1:end-1), abs(Y2))
xlabel('Frequency, [Hz]')
ylabel('Power')
legend('Noisy signal', 'Cleaned signal')

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!