How to increase FFT resolution?

This read-only archive contains discussions from the Adding Feature forum.
New feature request may be posted to the Adding Feature forum.
Technical support is available via the Help forum.
steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: How to increase FFT resolution?

Post by steve » Fri Mar 01, 2013 3:48 pm

fonon wrote:The "Size" parameter in "Analyze/Plot Spectrum" is still restricted to 2^14 samples (Windows version). Could you explain what it means and why the ranges of "window size" in "Preference/Spectrograms" and "size" in "Analyze/Plot Spectrum" are different?
I previously asked: "Which FFT window size are you asking about? Plot Spectrum? Wave track spectrogram view? The Equalization effect? Somewhere else?"
Your reply was ambiguous. Do I take it that you are referring to "Plot Spectrum"?

Other places where FFT size is implanted include the Equalization effect and the track Spectrogram view. The latter is set in Spectrograms Preferences and it is here where the FFT size has options up to 2^15 and it is here where it is too slow to raise it higher than 2^15.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

fonon
Posts: 26
Joined: Tue Feb 26, 2013 10:23 am
Operating System: Please select

Re: How to increase FFT resolution?

Post by fonon » Fri Mar 01, 2013 5:07 pm

steve wrote:I previously asked: "Which FFT window size are you asking about? Plot Spectrum? Wave track spectrogram view? The Equalization effect? Somewhere else?"
Your reply was ambiguous. Do I take it that you are referring to "Plot Spectrum"?
OK. The second post in thread by Kozikowski was focused on "Plot Spectrum" and we are going this path. I need to do the spectral analysis of the wave file with numeric output. The "Analyse/Plot Spectrum" seems to be a corresponding option. How to increase the FFT window size used in this procedure up to 2^16 samples?
f.

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: How to increase FFT resolution?

Post by steve » Fri Mar 01, 2013 5:37 pm

fonon wrote:OK. The second post in thread by Kozikowski was focused on "Plot Spectrum"
The post by Koz was about the Spectrogram preferences:
Audacity > Preferences > Spectrograms > FFT Window.
That's the only setting I know of.
Koz"


I suspected that this was not what you meant, which is why I asked. ;)
Anyway, I think we're clear now that we are talking about "Plot Spectrum".

This seems to be a simple change and I agree that it could be useful when looking at lower frequencies.
The downside is (there had to be one didn't there ;)) is that spikes in the graph can become so thin that they are "invisible" for example, this is a 100 Hz square wave - you will notice that many of the expected harmonics cannot be seen with such a large FFT size, so this feature, if implemented, needs to be used intelligently.
sqwave.png
sqwave.png (41.55 KiB) Viewed 3398 times
I've attached a patch against the current "svn head" source code. If you'd like to test this and it works for you then I'll submit the patch to the developers for their review and consideration.
Attachments
PlotSpectrumFFTSize.patch
(993 Bytes) Downloaded 109 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Robert J. H.
Posts: 3633
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: How to increase FFT resolution?

Post by Robert J. H. » Sat Mar 02, 2013 12:10 am

If you only want the numerical values, you can as well use the ttf function of Nyquist. As far as I know, the bins are not limited.
A very simple example, that lets you hear the amplitudes within a saw-table. Resolution is 32768 bins. The resulting array is immediately reversed into a sound in order to modulate the sine tone.

Code: Select all

(setf sig (abs-env (osc (hz-to-step 2000) 
   (/ 32768 *sound-srate*) *saw-table*)))
(setf fft (snd-from-array 0 4410 (snd-fft sig 32768 32768 nil))) 
(setf fft (snd-avg fft 30 1 op-peak))
(setf peak (peak fft ny:all))
(abs-env (hzosc (sum  440 (mult (/ 440.0 peak) fft)))) 

fonon
Posts: 26
Joined: Tue Feb 26, 2013 10:23 am
Operating System: Please select

Re: How to increase FFT resolution?

Post by fonon » Mon Mar 04, 2013 2:42 pm

steve wrote: I suspected that this was not what you meant, which is why I asked. ;)
Anyway, I think we're clear now that we are talking about "Plot Spectrum".
My mistake! I'm very sorry. I must be blind.
steve wrote: This seems to be a simple change and I agree that it could be useful when looking at lower frequencies.
The downside is (there had to be one didn't there ;)) is that spikes in the graph can become so thin that they are "invisible" for example, this is a 100 Hz square wave - you will notice that many of the expected harmonics cannot be seen with such a large FFT size, so this feature, if implemented, needs to be used intelligently.
The graph of amplitude spectrum is based on window size/2 data points.There is a problem with visualization of any high-resolution spectrum. The resolution of standard computer monitor doesn't exceed 2000 pixels in horizontal dimension. The spectrum calculated with window size over 2^12 samples can't be displayed properly on the screen in full. Fortunately, there is numeric output...
steve wrote: I've attached a patch against the current "svn head" source code. If you'd like to test this and it works for you then I'll submit the patch to the developers for their review and consideration.
Unfortunately, I can't compile both svn and regular source code on my machine. I tried, but the operating system (MDV2011 x64) crashed due to upgrade of libraries requested by compiler. Now, I must reinstall it.
Regards,
f.
Last edited by fonon on Tue Mar 05, 2013 10:05 am, edited 1 time in total.

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: How to increase FFT resolution?

Post by steve » Mon Mar 04, 2013 4:38 pm

fonon wrote:Unfortunately, I can't compile both svn and regular source code on my machine.
Not to worry.
I've submitted the patch for consideration.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: How to increase FFT resolution?

Post by steve » Fri Mar 08, 2013 5:29 pm

Update: The patch that I submitted has passed preliminary testing and has been marked as "patch_ready". The next step is "code review" by one of the developers, which involves checking that the code tackles the issue in the correct way and meets coding standards (it's a simple patch so I see no reason why it shouldn't), then. assuming that it is OK, the patch will be "committed", which means that it will appear in the next release of Audacity.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

fonon
Posts: 26
Joined: Tue Feb 26, 2013 10:23 am
Operating System: Please select

Re: How to increase FFT resolution?

Post by fonon » Sat Mar 09, 2013 11:54 am

Thank You very much. I'm waiting for the next release of Audacity! I have a few questions for other FFT analysis parameters. I want to start a new thread.
Regards,
f.

waxcylinder
Forum Staff
Posts: 14684
Joined: Tue Jul 31, 2007 11:03 am
Operating System: Windows 10

Re: How to increase FFT resolution?

Post by waxcylinder » Mon Apr 08, 2013 1:03 pm

I assume that as Steve has supplied his patch, then this FR does not require transferring to the Wiki - correct?

Peter.
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * FAQ * * * * * Tutorials * * * * * Audacity Manual * * * * *

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: How to increase FFT resolution?

Post by steve » Mon Apr 08, 2013 5:23 pm

waxcylinder wrote:I assume that as Steve has supplied his patch, then this FR does not require transferring to the Wiki - correct?
It probably is worth putting on the wiki so that it does not get forgotten. It is currently logged on bugzilla as bug 622 (P4 Enhancement: marked "Patch Ready")
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Locked