template class LinearFFT : public ComplexFFT

This class represents a special FFT-tool for non-complex values as integers, floating point values or audio samples

Inheritance:

LinearFFT < ComplexFFT


Public Classes

enum ConvMethod
conversion methods which can be used to convert a complex floating point value to a non-complex value

Public Fields

typedef vector Spectrum
vector containing the frequency domain of a signal.

Public Methods

ConvMethod convMethod()
returns the used conversion method
void fft(const AudioCache& cache, Spectrum& spectrum)
takes the signal stored in the cache, performs the FFT and stores the result into the given vector
void invfft(const Spectrum& spectrum, AudioCache& cache)
takes the spectrum stored in the vector, performs the inverse FFT and stores the result into the given cache
explicit LinearFFT(const size_t samples, const WindowFunc winFunc = NONE, const ConvMethod method = SQR)
creates the tool for the "linear" FFT
virtual void printOn(ostream& os)
prints the FFT parameter on the given output stream
void set(const size_t samples, const WindowFunc winFunc, const ConvMethod method)
specifies FFT parameters
~LinearFFT()
destroy the object.

Public

enum ConvMethod
conversion methods which can be used to convert a complex floating point value to a non-complex value

Protected Fields

ConvMethod vMethod
used conversion method.

Protected Methods

T calcAmp(const ComplexSample& csample)
converts the specified complex amplitude value into a non-complex value
Float calcComplexADD(const ComplexSample& csample)
returns value = real + imag (maybe someone needs it)
Float calcComplexAMP(const ComplexSample& csample)
returns sample amplitude: value = sqrt(real^2 + imag^2)
Float calcComplexDB(const ComplexSample& csample)
returns sample amplitude in dB
Float calcComplexPHA(const ComplexSample& csample)
returns the phase: value = atan(imag / real)
Float calcComplexSQR(const ComplexSample& csample)
returns value = real^2 + imag^2
Sample round(Float num)

Private Fields

mutable ComplexWave* wave
temporary vector used for complex floating point values.

Inherited from ComplexFFT:

Public Classes

enum WindowFunc

Public Fields

typedef Complex <Float> ComplexSample
typedef vector <ComplexSample> ComplexWave
typedef double Float

Public Methods

size_t bits()
static size_t bitsFor(size_t samples)
size_t samples()
WindowFunc windowFunc()

Public

enum WindowFunc

Protected Fields

size_t vBits
size_t vSamples
WindowFunc vWindowFunc

Protected Methods

virtual void init(const size_t samples, const WindowFunc winFunc)

Private Fields

Float* CosineTable
Float* SineTable
Float* WinTable

Private Methods

void reorder(ComplexWave& wave)
const unsigned int reverse(unsigned int val)
void scale(ComplexWave& wave)
void unwindow(ComplexWave& wave)
void window(ComplexWave& wave)

Documentation

This class represents a special FFT-tool for non-complex values as integers, floating point values or audio samples. It is based on the ComplexFFT for complex floating point values. This tool was implemented to make the FFT on AudioCaches some easier then when ComplexFFT is used.
enum ConvMethod
conversion methods which can be used to convert a complex floating point value to a non-complex value.
DB =
SQR =
ADD =
AMP =
PHA =

typedef vector Spectrum
vector containing the frequency domain of a signal.

explicit LinearFFT(const size_t samples, const WindowFunc winFunc = NONE, const ConvMethod method = SQR)
creates the tool for the "linear" FFT.
Throws:
Exception , if memory allocation fails
Parameters:
samples - specifies the window size
winFunc - specifies the windowing function
method - specifies the conversion method for complex values

~LinearFFT()
destroy the object.

void fft(const AudioCache& cache, Spectrum& spectrum)
takes the signal stored in the cache, performs the FFT and stores the result into the given vector.
Parameters:
cache - audio cache containing the signal (time domain)
spectrum - vector for the result (frequency domain)

void invfft(const Spectrum& spectrum, AudioCache& cache)
takes the spectrum stored in the vector, performs the inverse FFT and stores the result into the given cache.
Parameters:
spectrum - vector containing the spectrum (frequency domain)
cache - audio cache containing the signal (time domain)

void set(const size_t samples, const WindowFunc winFunc, const ConvMethod method)
specifies FFT parameters. This method can be used to change the window size or the windowing function after the tool was created.
Throws:
Exception , if memory allocation fails
Parameters:
samples - specifies the window size
winFunc - specifies the windowing function
method - specifies the conversion method for complex values

ConvMethod convMethod()
returns the used conversion method.
Parameters:
information - about the counversion method

virtual void printOn(ostream& os)
prints the FFT parameter on the given output stream.
Parameters:
os - output stream

T calcAmp(const ComplexSample& csample)
converts the specified complex amplitude value into a non-complex value. Uses the specified conversion method.
Returns:
non-complex value
Parameters:
complex - amplitude value

Float calcComplexSQR(const ComplexSample& csample)
returns value = real^2 + imag^2

Float calcComplexADD(const ComplexSample& csample)
returns value = real + imag (maybe someone needs it)

Float calcComplexAMP(const ComplexSample& csample)
returns sample amplitude: value = sqrt(real^2 + imag^2)

Float calcComplexPHA(const ComplexSample& csample)
returns the phase: value = atan(imag / real)

Float calcComplexDB(const ComplexSample& csample)
returns sample amplitude in dB

Sample round(Float num)

ConvMethod vMethod
used conversion method.

mutable ComplexWave* wave
temporary vector used for complex floating point values.


This class has no child classes.
Author:
Silvia Pfeiffer, Peter Tomczyk
Version:
$Id: linfft.h,v 1.9 1998/04/14 10:26:27 tomczyk Exp $

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de