This page was last modified 21:31, 13 December 2007.
FFT algorithm
From Forum Nokia Wiki
Contents |
Introduction
Fast fourier transform (FFT) is one of the key algorithms of digital signal processing (DSP). Combined with the mobile capabilities of S60 devices it opens up a wide range of new possibilities for applications.
Setup
Using FFT/IFFT algorithms in S60 is quite simple with the following instructions.
1) Download FFT algorithm by Laurent de Soras for C++.
2) Port the algorithm for Symbian with the following minor modifications:
- Set the used data type in fftreal.h:
typedef TReal flt_t;
- Create standard two-phased constructors:
static CFFTReal* NewL(const TInt aLength); void ConstructL();
- Add epoc32\include\libc to additional include directories and link against estlib.lib
- Modify FFTReal to inherit CBase and add #include <e32base.h>
Using the algorithm
Normal FFT:
fftreal ->Fft(fft, x);
Inverse FFT:
fftreal->Ifft(fft, x); fftreal->Rescale(x);
Important As the FFT coefficients may have complex values, they will be presented in format: <Real values of coefficients 0-n><Complex values of coefficients 0-n>. This way the length of the FFT result array is the same as the number of FFT points.
Example
#include "fftreal.h" // FFT length must be a power of 2 TInt frame = 1024; // Create objects FFTReal* fftreal = FFTReal::NewL(frame); FFTReal::flt_t * const x = new (ELeave) FFTReal::flt_t[frame]; FFTReal::flt_t * const fft = new (ELeave) FFTReal::flt_t[frame]; // Fetch the source signal from somewhere (eg. audio) GetSourceSignal(x); // Actual FFT calculation fftreal ->Fft(fft, x); // Modify FFT coefficients etc. ModifyFFT(fft); // Convert back to time domain, note the important Rescale() // after every Ifft() call! fftreal->Ifft(fft, x); fftreal->Rescale(x); // Do something with the result ProcessResult(x); delete fft; delete x; delete fftreal;
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to detect DTMF while calling | squander | Symbian Networking & Messaging | 8 | 2008-05-20 14:12 |
| Zlib | Nuria | Mobile Java General | 1 | 2004-10-06 02:41 |
| Determine if user is speaking | pkosonen | Symbian Media (Graphics & Sounds) | 0 | 2005-07-21 10:10 |
| S40 decodes IMSI | mark_w | General Discussion | 0 | 2008-07-23 14:44 |
| mmapi 1.1 and mp3 | brunk | Mobile Java Media (Graphics & Sounds) | 13 | 2008-10-04 14:04 |
