I would like to perform STFT on musical signal with defined sampling rate (
I would like to get FFT result for smaller range of frequencies than are maximally available
22050Hz but for
4000Hz) so the result will have better frequency resolution.
So I think I should downsample it, but how can you downsample to the frequency
that is not in integer relation to the input frequency (you cannot leave the kth sample)?
Do you do some kind of interpolation to get values of new samples?
How does it affect the signal?
I also know I should filter out the frequencies higher than
the signal would get aliased. Is there some kind of filter revelant for usage in STFT?
All I know about filters is that to get better (more sharp) filter you need more coefficents and so it will take more time to calculate. I know there are IIR filters and FIR filters. I read IIR filters can be unstable but should I care about it if I use a ready implementation (and I assume it's done right)?
Is it better to filter the whole signal (whole audio file) at once? If I get the infite response from the IIR filter and I filter the whole signal at once will the energy be most smudged at the end part of the signal?
I also read filters can pose some kind of delay on the frequencies and it differs for different frequencies. How do you analyse and compensate this phenomenon?
Edit: I found that you can get FIR with linear delay and that now they are used more often than IIR. But there's still a delay, what does it mean? That the frequency events (like musical notes) will occur later in sample number time? What will be this delay?
Edit2: When I want to downsample to sampling rate of
8000Hz I have to filter so there won't be any frequencies over
4000Hz. Is this practically possible, because I looked at different FIR filters characteristics and they just seem to greatly damp the stopband frequencies not to eliminate them? If I will have just a bit of the high frequencies in the signal, will the signal look ok when downsampled (aliasing won't be noticeable)?