How to find Frequencies to filter?

Illustration
Francisco - 2021-03-25T12:20:09+00:00
Question: How to find Frequencies to filter?

I am trying to find and determine what frequencies need filtering. I have an audio signal with a hiss noise at the first 2 seconds of my signal, the hiss has like 4 levels of hiss and each level increases and suddenly stops. I am trying to filter out that hiss using either FIR or IIR (haven't done a deeper research to decide which one to use, Probably FIR [but open for guidance]). My question is where do I look for my frequencies? I have the time signal, fft, spectogram, log scale.

Expert Answer

Profile picture of Prashant Kumar Prashant Kumar answered . 2025-11-20

seems you need a low pass filter with a cut off frequency around 2.5 kHz - order to be defined / tested
 
you should apply it only on the first 1.7 s where the hiss is present
 
of course the LP filter will also reduce useful infos of the audio signal in that portion of the signal.
 
Just in case it might further help you , I share my code for FFT / specgram analysis.
 
I'd suggest to do an averaged pwelch spectrum of the first 1.5 s to see the slope of the hiss noise , to determine which LP order would be needed to flaten or get even a negative slope of the filtered signal.
demo:
 
clc
clear all

% hi 
% may I Jump in the conversation ? 
% there are so many questions in this forum dealing with fft , and many times it is not always clear for everybody how to get the best result according to what kind of signals are being analysed (random, harmonics, stationnary or not ...).
% I like to propose this little demo based on pwelch and spegram to give another point of view and also let the people play with fft size, overlap , windows and see the effect on frequency resolution, amplitude resolution etc...


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dummy signal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Fs = 5000;
samples = 255001;
dt = 1/Fs;

t = (0:dt:(samples-1)*dt);
omega = 2*pi*(25+20*t);

sensordata = randn(size(t)) + 5*sin(omega.*t);  % signal = linear chirp + noise
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% FFT parameters
samples = length(sensordata);
NFFT = 512;    % 
NOVERLAP = round(0.75*NFFT);
w = hanning(NFFT);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% option 1 : averaged FFT spectrum
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[sensor_spectrum, freq] = pwelch(sensordata,w,NOVERLAP,NFFT,Fs);

figure(1),plot(freq,20*log10(sensor_spectrum));
title(['Averaged FFT Spectrum  / Fs = ' num2str(Fs) ' Hz / Delta f = ' num2str(freq(2)-freq(1)) ' Hz ']);
xlabel('Time (s)');ylabel('Amplitude (dB)');


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% option 2 : time / frequency analysis : spectrogram demo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

saturation_dB = 80;  % dB range scale (means , the lowest displayed level is 80 dB below the max level)
% fmin = 1;
% fmax = Fs/2;

[sg,fsg,tsg] = specgram(sensordata,NFFT,Fs,w,NOVERLAP);  

% FFT normalisation and conversion amplitude from linear to dB peak
sg_dBpeak = 20*log10(abs(sg))+20*log10(2/length(fsg));     % NB : X=fft(x.*hanning(N))*4/N; % hanning only

% saturation to given dB range
mini_dB = round(max(max(sg_dBpeak))) - saturation_dB;
sg_dBpeak(sg_dBpeak<mini_dB) = mini_dB;

% plots spectrogram
figure(2);
imagesc(tsg,fsg,sg_dBpeak);axis('xy');colorbar('vert');
title(['Spectrogram  / Fs = ' num2str(Fs) ' Hz / Delta f = ' num2str(fsg(2)-fsg(1)) ' Hz ']);
xlabel('Time (s)');ylabel('Frequency (Hz)');


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!