spectrogram: Be able to choose the DFT size #650
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
spectrogram: Be able to choose the DFT size
Description
spectrogramchooses a DFT size of2 * (y_size - 1), a hangover from whenthe frequency axis always went from 0 to
sample_rate / 2so as to getone output pixel per frequency bin.
Now that there is
spectrogram -Rto choose an arbitrary frequency range for the axis,not to mention
-Lfor a logarithmic axis, this choice has no foundation any more.The DFT size determines two related things:
It would be better if users could specify the DFT size (probably not directly - see below)
to trade off frequency resolution against time resolution.
It would also be better if the default DFT size were chosen according to the time represented by one pixel column so that all input samples are equally represented in the graph; at present, for a long piece, the DFTs are widely spaced in time so many samples
do not count at all towards the output.
Analysis
spettro, instead of talking in DFT sizes, has the happy concent of "FFT frequency"which is the frequency difference between the centers of any two adjacent DFT output bins
and is also approximately the number of sonic events that can be determined per second.
The DFT size is then the sampling rate divided by the FFT frequency (or twice that figure).
-fis one of the few letters not currently an option tospectrogram.Conclusion
Select a default DFT size according to the number of samples covered by each column
of the graph so that all input samples are equally represented in the output, checking
how that interacts with the resolution in the frequency domain.
Provide an "FFT frequency" option and, if it is given, choose the DFT size based on that
and the sample rate.