swharden/FftSharp

Question about FftsToProcess

Closed this issue · 1 comments

Hello Scott,

That's for your ScottPlot and that helped me a lot during my work.
Recently I am reading and learning STFT and are using this Fftsharp, while I notied in SpectrogramGenerator.cs, line40:
public int FftsToProcess { get => (UnprocessedData.Count - Settings.FftSize) / Settings.StepSize;

Here I got a small question and do not figured out yet, so I leave a message to see if you could give me a hint.
By my understanding, FftsToProcess might equals to the number that the whole time-domain data contains fftsize, so by my understanding I thought this might be UnprocessedData.Count/StepSize, So I don't know why you minus one FFTSize here...

And I got another small question, say If I am going to get a spectrogram of a finite length of waveform instead of a couninous one, for the last part of data which might not be the length of FFTSize, should I just add 0 to make it equals the FFTSize? or there's other professional ways to do this? I am not a profession in DSP so hopefully my question is not too silly..

Again thanks to your work, you really helped me a lot.~

Hi @rdengqlink,

Regarding FftsToProcess, my quick guess is that calculating the FFT requires at least Settings.FftSize points to process, so it UnprocessedData.Count is less than this value the FftsToProcess will return 0 to indicate there's not enough incoming data to allow a FFT to be calculated.

Regarding how to measure FFT of a fixed-length waveform, indeed, padding with zeros should do the trick! I think there is a helper function which can make this easier: FftSharp.Pad.ZeroPad()