Important alert: (current site time 10/22/2014 5:16:45 PM EDT)
 

winzip icon

Fast Fourier Transformation and Inverse Fast Fourier Transformation (FFT & IFFT) Class

Email
Submitted on: 4/6/2006 5:55:57 PM
By: ULLI 
Level: Advanced
User Rating: By 21 Users
Compatibility: VB 6.0
Views: 16491
author picture
(About the author)
 
     Class and exhaustive test rig for FFT and IFFT. See screenshot. Updated for substantial speed improvemnt. Download is 8 kB

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 111 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

4/5/2006 2:54:58 AMRobert Rayment

Very neat Ulli ***** An aside, interesting playing around with the timer interval and with and without Priority. EG setting timer to 2 milli-secs and no priority is very fast but 70% CPU usage etc.
(If this comment was disrespectful, please report it.)

 
4/5/2006 4:30:11 AMUlli

yep; lots of math going on, robert *smile*
(If this comment was disrespectful, please report it.)

 
4/5/2006 6:17:43 AMRaziel

Wow Ulli .. nice to see someone is still coding on vb6 ;) 5* of course (as allways :P)
(If this comment was disrespectful, please report it.)

 
4/5/2006 6:52:48 AMPaul Caton

Wow, FFT in VB, whatever next? Re "can anyone think of a faster solution?" - use a look up table?
(If this comment was disrespectful, please report it.)

 
4/5/2006 7:56:12 AMUlli

@Paul

Creating the lookup table with n/2 entries plus looking up would probably be equally slow. All I can think of is Robert's MASM. In ASM it can be done in a loop with three machine instructions using registers only.
(If this comment was disrespectful, please report it.)

 
4/5/2006 11:31:58 AMPaul Caton

Are sure about 3 instructions? I had a spare hour this afternoon and made a version of your class that uses a class patch to reverse the bit order in machine code. If you email me I'll send it over. No extra files, it's all encapsulated in clsFourier.cls
(If this comment was disrespectful, please report it.)

 
4/5/2006 12:53:23 PMCybsoft

Real nice code, 5 balls from me.
Would love to have this work frome "live" soundcard input ! Anny idea's on how to make that work ?
(If this comment was disrespectful, please report it.)

 
4/6/2006 6:34:46 AMUlli

Thanks Paul, I didn't think of the VTable and to be honest I never got quite round to investigate them properly. This is surely faster than calling CallWindowProc. I more or less did a quick and dirty copy of Robert's ASM-mechanism.
(If this comment was disrespectful, please report it.)

 
4/6/2006 7:54:54 AMRobert Rayment

As I see it the more complicated VTable method is only worth it if the alternative was to call CallWindowProc a large number of times else the extra time is only for one call which is negligible.
(If this comment was disrespectful, please report it.)

 
4/6/2006 8:02:03 AMRobert Rayment

In your case the CallWindowProc is called UBSample times - so probably worth using the VTable.
(If this comment was disrespectful, please report it.)

 
4/7/2006 9:34:06 AMUlli

Using a vTable patch now for bit mirroring which has improved the speed (when compiled) by about 25%.
(If this comment was disrespectful, please report it.)

 
4/8/2006 1:08:49 AMRobert Rayment

Ulli: might be worth including the i = 0 To USamples in your asm code, saving several thousand call/returns.
(If this comment was disrespectful, please report it.)

 
4/8/2006 6:15:04 AMUlli

@Robert:
Well - the next thing to tackle is the butterfly calculation. Transfering from one table to another plus two fp-divisions just takes 100 µsecs for 2048 samples as you can see: reverse transforming adds about that amount of time due to the normalizing loop which is then performed additionally.
(If this comment was disrespectful, please report it.)

 
4/13/2006 1:50:31 PM[rm_code]

A handy and fast FFT, thanks!
I'll probably use it for my Monoton project.
(If this comment was disrespectful, please report it.)

 
6/18/2006 10:00:59 PMAlanMN

Wow... 5*
(If this comment was disrespectful, please report it.)

 
6/26/2006 9:22:18 AMDolac

5*.. no mistake bout it..
(If this comment was disrespectful, please report it.)

 
4/8/2007 3:10:30 AMNick Williams

This code has proved invaluable to me. I commend you on your efforts and kickass code. You've literally saved my neck from DSP slowness. I owe you a beer.
(If this comment was disrespectful, please report it.)

 
5/19/2008 9:26:21 AMevans vans

Wonderful piece of code. Keep it up
(If this comment was disrespectful, please report it.)

 
3/14/2010 3:59:51 PMSteppenwolfe

Hi Ulli
I used you FFT in a C# project, converted it to use pointers etc.
http://www.codeproject.com/KB/cs/PWR.aspx
(If this comment was disrespectful, please report it.)

 
3/17/2010 5:55:35 AMULLI

@John

I am glad to learn that this project has "survived" in another app
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.