Quick FFT question
-
- KVRian
- Topic Starter
- 574 posts since 6 Jan, 2003 from Somewhere between ))o Left and Right o((
I don't know mouch about FFT analyzing a signal, so I have questions :
I know that I have to store the signal in a table with size power of 2. Than I have to make a wavetable comtaining a sine wave (or raised cosine?).
I search for the peak amplitude, and store it for later.
Than I substract the sine waveform from the signal table, search for maximum in the result table, and store the ratio between the two peak walues. Than I make the same for sin(2x),sin(3x) ...
Am I far away from truth ?
If I'm close, than does it matter the phase of the source signal ?
What about cosine components ? Every spectrum analyzer shows sine components only.
Can anybody point me to the right direction?
Thanks,
A.F.
I know that I have to store the signal in a table with size power of 2. Than I have to make a wavetable comtaining a sine wave (or raised cosine?).
I search for the peak amplitude, and store it for later.
Than I substract the sine waveform from the signal table, search for maximum in the result table, and store the ratio between the two peak walues. Than I make the same for sin(2x),sin(3x) ...
Am I far away from truth ?
If I'm close, than does it matter the phase of the source signal ?
What about cosine components ? Every spectrum analyzer shows sine components only.
Can anybody point me to the right direction?
Thanks,
A.F.
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
Wow!!
Fourier Transform is not reduced to powers of two!!
First search on the Internet what it is, just for a background.
FFT is classical implementation of DFT - for Discrete FT -, which WAS limited to powers of two. Nowadays, it doesn't matter if you catch the good librairy - FFTW is far the best, implemented in Matlab -.
Consider using a existant librairy, it'll be safer. BUT if you want to do it yourself :
- have a sine wave in your table
- use the FFT radix2 or radix4 for less multiplications. If you try convolution, it's not FFT, it still costs O(N^2) whereas FFT costs only O(N log(N))
- you then have the complex amplitude of the frequency in the table between 0 and N/2-1. What is shown is the absolute value of the complex amplitude, never the real - cos - or imagniary - sin - part.
You can check chirp z-transform for other frenquency analysis or wavelets when you'll be at ease with the FFT
Fourier Transform is not reduced to powers of two!!
First search on the Internet what it is, just for a background.
FFT is classical implementation of DFT - for Discrete FT -, which WAS limited to powers of two. Nowadays, it doesn't matter if you catch the good librairy - FFTW is far the best, implemented in Matlab -.
Consider using a existant librairy, it'll be safer. BUT if you want to do it yourself :
- have a sine wave in your table
- use the FFT radix2 or radix4 for less multiplications. If you try convolution, it's not FFT, it still costs O(N^2) whereas FFT costs only O(N log(N))
- you then have the complex amplitude of the frequency in the table between 0 and N/2-1. What is shown is the absolute value of the complex amplitude, never the real - cos - or imagniary - sin - part.
You can check chirp z-transform for other frenquency analysis or wavelets when you'll be at ease with the FFT
-
- KVRian
- Topic Starter
- 574 posts since 6 Jan, 2003 from Somewhere between ))o Left and Right o((
I think I'm going to sleep now...
The mouch new info, can damage my brain.
- use the FFT radix2 or radix4
??? It's chemistry for me
- convolution ? I heard of it, never got a good explanation
- wavelets ? Lot of math.
The mouch new info, can damage my brain.
- use the FFT radix2 or radix4
??? It's chemistry for me
- convolution ? I heard of it, never got a good explanation
- wavelets ? Lot of math.
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
with power of two, you get radix2 because each time you process 2 samples, with power of 4, you get radix4 beacause each time, you process 4 samples. The avantages of these radix are that it is mainly additions and not multiplications, and as multiplications are the more time consumming, the less the better .tranceinstitute wrote: I think I'm going to sleep now...
The mouch new info, can damage my brain.
- use the FFT radix2 or radix4
??? It's chemistry for me
Begin with a discret normal fourier transform, not the FFT, before. If you have something like numerical recipes in C, try it, or on the net it's explained first in the continuous case, and then in the discrete case.
Well, my fault, it's not convolution you used, but correlation, which is almost the same...- convolution ? I heard of it, never got a good explanation
convolution(j) = sum(x(i)h(j-i), i=-inf...+inf)
correlation(j) = sum(x(i)h(i+j), i=-inf...+inf)
Yes...- wavelets ? Lot of math.
-
- KVRian
- Topic Starter
- 574 posts since 6 Jan, 2003 from Somewhere between ))o Left and Right o((
Can you paste some good links pleaseMiles1981 wrote: First search on the Internet what it is, just for a background.
-
- KVRian
- 922 posts since 26 Mar, 2003 from Guildford, England
Convolution is one of the most important aspects of DSP.tranceinstitute wrote: - convolution ? I heard of it, never got a good explanation
Basically an FIR uses convolution - its essentially a multitap delay where the number of taps = the number of samples in the impulse response, and the magnitude and sign of each tap is represented by the value of the samples in the impulse response. The delay time of each tap is equal to the offset into the impulse response in samples.
It is also possible to convolve in the frequency domain using FFT & iFFT.
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
Yes, it is one of the advantages of the FFT - although you must pay attention to the side effects -.
A page with some links, taken from FFTW : http://www.fftw.org/links.html it's the fastest FFT I've ever seen.
A page with some links, taken from FFTW : http://www.fftw.org/links.html it's the fastest FFT I've ever seen.
-
- KVRian
- Topic Starter
- 574 posts since 6 Jan, 2003 from Somewhere between ))o Left and Right o((
What is the difference between adding up
N sine waves with given amplitude,phase
and doing it with iFFT (nasty complex numbers) ?
N sine waves with given amplitude,phase
and doing it with iFFT (nasty complex numbers) ?
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
The inverse FFT has a complexity of NlogN, whereas adding the sines - making a inverse transform in the "normal way" - is N². It speeds up the function. But you can't use the past of the signal, so if you filtered something in the spectral domain, I don't know if the signal will join correctly. At this time, you should filter the signal with the past - the Fourier transform and its inverse transform are mainly 2 filters with specials coefficients -
-
- KVRian
- Topic Starter
- 574 posts since 6 Jan, 2003 from Somewhere between ))o Left and Right o((
My question is simple:
Is is correct to make my waveform by adding up sines with a for(;;;) instead of iFFT ?
If not, why ?
What is the advantage on iFFT over adding up sines ? Other than speed. I ask this to decide to transform my wavetable engine to iFFT (meaning i have to deal with complex numbers and other nasty stuff) or keep it the way it is.
Is is correct to make my waveform by adding up sines with a for(;;;) instead of iFFT ?
If not, why ?
What is the advantage on iFFT over adding up sines ? Other than speed. I ask this to decide to transform my wavetable engine to iFFT (meaning i have to deal with complex numbers and other nasty stuff) or keep it the way it is.
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
yes, it is valid, as iFFT is just a reformulation of the for.
The warning is still there : if the signal has a past, it could be incorrect.
The advantages of iFFT is its speed, its only a reformulation of the inverse transform discribed by adding sines.
You can deal without complex numbers : a sine is described by its frequency, its phase and its amplitude. The complex numbers take care of the frequancy and the phase, that's all. It's not that nasty
The warning is still there : if the signal has a past, it could be incorrect.
The advantages of iFFT is its speed, its only a reformulation of the inverse transform discribed by adding sines.
You can deal without complex numbers : a sine is described by its frequency, its phase and its amplitude. The complex numbers take care of the frequancy and the phase, that's all. It's not that nasty
-
- KVRer
- 3 posts since 10 Feb, 2004 from ann arbor mi
AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
the book elements of computer music (http://www.amazon.com/exec/obidos/tg/detail/-/0132525526/qid=1086965971/sr=8-1/ref=pd_ka_1/002-3153664-7323258?v=glance&s=books&n=507846) by f. richard moore has a pretty straightforward explanation of fft, convolution, etc. it's all in the context of the applications to audio purposes as well, with a lot of code examples too. it's a bit pricey since it's a college textbook but worth checking out if you can find a used copy at least.-
- KVRAF
- 6741 posts since 25 Mar, 2002 from sheffield, england
http://www.dspguide.com/tranceinstitute wrote: Can you paste some good links please
It's great: v informative, easy to read & it has several chapters devoted to DFT/FFT, which you can download as pdf's free of charge..