1

I'm a newbie learning FFT, I'm writing fft using swift vDSP to process audio from the microphone.

My goal is to fine-tune the calculation to 0.1 Hz on the audio whose frequency changes every 0.1 seconds.

For example, there will be a very strong audio frequency of 582.0 Hz at 0.1 seconds, and it will change to 582.1 Hz at 0.2 seconds. I have to output every 0.1 seconds, the strongest Hz within the range of concern. Or at least 0.3 Hz.

When I set the sampling frequency to 44100 Hz, fft sample count to 131072, and hop size to 512, I found that I would get the wrong results. For example, the output seemed to be blurred. The high decibel of 582 Hz lasted for a long time, and 582.1 also lasted will last long.

But when the sample count is reduced to 8192, the output will be relatively correct, but the frequency is not fine enough to 0.1Hz.

I would like to ask if there is a way to increase the resolution of time and increase the resolution of frequency at the same time. Or are my needs not suitable for FFT as a tool? There are other algorithms?

I got stuck on this part for days and weeks. Thank you so much.

pekkabear
  • 55
  • 5
  • 1
    What is the “hop size”? How is the output blurred? How does a high decibel last long? This might be language issue, but I don’t understand the problem. The amount of time you can sample the signal (0.1s) determines the resolution in the frequency domain. But there are techniques to more precisely determine the frequency of a signal. – Cris Luengo Feb 21 '23 at 19:20
  • @CrisLuengo Sorry about the language problem, I tried to rephrase it. The hop size means the number of samples between each successive FFT window, equal to frame size minus frame overlap. The output blurred means I look at the spectrogram of the output and I expect the dB at 582Hz to stay high for about 0.25 seconds, but it actually stays high for over a second. – pekkabear Feb 21 '23 at 19:41
  • @CrisLuengo May I ask what technology can improve the resolution? Thanks – pekkabear Feb 21 '23 at 19:43
  • 1
    Look here: https://dsp.stackexchange.com/a/76659/33605 /// The "blurring" issue could be a bug in your code, I can't comment on it without seeing the code. – Cris Luengo Feb 21 '23 at 20:08
  • 1
    This belongs on dsp.stackexchange.com. However, I strongly expect it's impossible. To get a 0.1Hz frequency resolution, you need a 10s temporal resolution. You won't be able to distinguish precisely when a signal began or ended within those 10s. This is the "blurring" your describing, and it's a fundamental part of sampling (not just FFT; every kind of sampling). I have heard of some advanced "super-resolution" techniques using multiple signals, but this doesn't really apply in this case. – Rob Napier Feb 21 '23 at 21:30
  • 1
    For more, see: https://electronics.stackexchange.com/questions/12407/what-is-the-relation-between-fft-length-and-frequency-resolution, https://dsp.stackexchange.com/questions/81764/methods-to-increase-fft-time-resolution-without-lowering-fft-size, https://dsp.stackexchange.com/questions/4878/possibility-of-temporal-super-resolution – Rob Napier Feb 21 '23 at 21:33
  • 1
    What kind of noise (i.e. non-signal-in-question) does the signal record have? If there's only a minimal noise, I guess it might be possible to fit the signal at a 0.1sec interval with a sinusoid f(t)=Asin(2pi*w*t + t0) and derive w from there. If you insist on FFT, you may try using 4092 sample size and fit the spectral leakage function to the FFT. – smitsyn Feb 22 '23 at 10:18
  • I read a lot of information provided by you, and checked a lot of information, I also tried the method of time domain and frequency domain, thank you three very much! – pekkabear Mar 03 '23 at 14:30

0 Answers0