iso::synth::FFTUnit Class Reference

performs fast fourier transformation More...

#include <iso_synth_fft_unit.h>

Inherits iso::synth::ProcessUnit.

Inheritance diagram for iso::synth::FFTUnit:

Inheritance graph
[legend]
Collaboration diagram for iso::synth::FFTUnit:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FFTUnit ()
 default constructor
 FFTUnit (const String &pName)
 name constructor
 FFTUnit (unsigned int pChannelCount)
 parameter based contructor
 FFTUnit (const String &pName, unsigned int pChannelCount)
 parameter based contructor
 FFTUnit (FunctionType pWindowType, unsigned int pOverlap)
 parameter based contructor
 FFTUnit (const String &pName, FunctionType pWindowType, unsigned int pOverlap)
 parameter based contructor
 FFTUnit (unsigned int pChannelCount, FunctionType pWindowType, unsigned int pOverlap)
 parameter based contructor
 FFTUnit (const String &pName, unsigned int pChannelCount, FunctionType pWindowType, unsigned int pOverlap)
 parameter based contructor
 FFTUnit (FunctionType pWindowType, unsigned int pOverlap, unsigned int pFrameCount, unsigned int pChannelCount, unsigned int pRate, FanInType pFanInType=FANIN_ADD)
 parameter based contructor
 FFTUnit (const String &pName, FunctionType pWindowType, unsigned int pOverlap, unsigned int pFrameCount, unsigned int pChannelCount, unsigned int pRate, FanInType pFanInType=FANIN_ADD)
 name and parameter based contructor
 FFTUnit (const FFTUnit &pUnit)
 copy constructor
 FFTUnit (const String &pName, const FFTUnit &pUnit)
 name & copy constructor
 FFTUnit (const data::Values &pValues) throw (SynthException)
 values based constructor
virtual ~FFTUnit ()
 destructor
virtual void process (Buffer *pBuffer) throw (SynthException)
 processes buffer
virtual String info (bool pPropagate=false, bool pShowPorts=true) const
 obtain textual unit information

Static Public Attributes

static const String sClassName
 default name

Protected Member Functions

void init ()
 initializes ports

Protected Attributes

BuffermAudioBuffer
 audio buffer
FunctionType mWindowType
 window type for windowing
ChannelmWindow
 window buffer
unsigned int mOverlap
 number of overlaps
unsigned int mSpectraCount
 total number of spectra per audio buffer
unsigned int mSpectrumStartNr
 first spectrum number
unsigned int mSpectrumNr
 current spectrum number
samplemFFTWAudioData
 audio data buffer for fftw
fftwf_complex * mFFTWSpectralData
 spectral data buffer for fftw
RingBuffermPreFFTAudioBuffer
 audio buffer which combines audio buffers before fft
Frame mPreFFTBufferReadPos
 relative read position into PreFFTRingBuffer
fftwf_plan mFFTPlan
 forward fft plan

Static Protected Attributes

static unsigned int sUnitCount
 total number of units created so far
static FunctionType sWindowType
 default window type for windowing

Friends

std::ostream & operator<< (std::ostream &pOstream, const FFTUnit &pUnit)
 print unit information

Detailed Description

performs fast fourier transformation

fourier transformation

This unit expands the basic process unit class.
It receives audio data at its audio input port and transforms it into spectral data that is output through the audio output port.
Apart from the standard configuration possibilities for processing units, this unit
allows users to specify the window type (GAUSS, HAMMING, HANN) and the number of overlaps between windows.

This unit is peculiar in that it works at the different rate than normal audio units
and in that the number of frames and channels differs at the audio input and output ports.
This values are calculated as follows (if no specified manually)

unit:
rate : synth default rate * 2.0 ^ (windowoverlap - 1)
frameCount : synth default frameCount
channelCount : synth default channelCount

input port:
rate : synth default rate
frameCount : synth default frameCount
channelCount : synth default channelCount

output port:
rate : synth default rate * 2.0 ^ (windowoverlap - 1)
frameCount : synth default frameCount / 2
channelCount : synth default channelCount * 2


SwitchPorts:
name: active channelCount: 1 defaultValue: 1.0 resizable: false function: setActive

Created by Daniel Bisig on 9/12/06.
Copyright 2006 Daniel Bisig All rights reserved.


Constructor & Destructor Documentation

FFTUnit::FFTUnit (  ) 

default constructor

FFTUnit::FFTUnit ( const String pName  ) 

name constructor

Parameters:
pName unit name

FFTUnit::FFTUnit ( unsigned int  pChannelCount  ) 

parameter based contructor

Parameters:
pChannelCount channel count

FFTUnit::FFTUnit ( const String pName,
unsigned int  pChannelCount 
)

parameter based contructor

Parameters:
pName unit name
pChannelCount channel count

FFTUnit::FFTUnit ( FunctionType  pWindowType,
unsigned int  pOverlap 
)

parameter based contructor

Parameters:
pWindowType window type
pOverlap number of overlaps

FFTUnit::FFTUnit ( const String pName,
FunctionType  pWindowType,
unsigned int  pOverlap 
)

parameter based contructor

Parameters:
pName unit name
pWindowType window type
pOverlap number of overlaps

FFTUnit::FFTUnit ( unsigned int  pChannelCount,
FunctionType  pWindowType,
unsigned int  pOverlap 
)

parameter based contructor

Parameters:
pChannelCount channel count
pWindowType window type
pOverlap number of overlaps

FFTUnit::FFTUnit ( const String pName,
unsigned int  pChannelCount,
FunctionType  pWindowType,
unsigned int  pOverlap 
)

parameter based contructor

Parameters:
pName unit name
pChannelCount channel count
pWindowType window type
pOverlap number of overlaps

FFTUnit::FFTUnit ( FunctionType  pWindowType,
unsigned int  pOverlap,
unsigned int  pFrameCount,
unsigned int  pChannelCount,
unsigned int  pRate,
FanInType  pFanInType = FANIN_ADD 
)

parameter based contructor

Parameters:
pWindowType window type
pOverlap number of overlaps
pFrameCount number of frames
pChannelCount number of channels
pRate samping rate
pFanInType strategy for combining audio buffers in case this unit is connected to several units

FFTUnit::FFTUnit ( const String pName,
FunctionType  pWindowType,
unsigned int  pOverlap,
unsigned int  pFrameCount,
unsigned int  pChannelCount,
unsigned int  pRate,
FanInType  pFanInType = FANIN_ADD 
)

name and parameter based contructor

Parameters:
pName unit name
pWindowType window type
pOverlap number of overlaps
pFrameCount number of frames
pChannelCount number of channels
pRate samping rate
pFanInType strategy for combining audio buffers in case this unit is connected to several units
Exceptions:
SynthException pFreqBinCount or pFrameCount not a power of two

FFTUnit::FFTUnit ( const FFTUnit pUnit  ) 

copy constructor

Parameters:
pUnit unit to copy properties from
constructor copies frameCount, channelCount and rate but not unit name

FFTUnit::FFTUnit ( const String pName,
const FFTUnit pUnit 
)

name & copy constructor

Parameters:
pName unit name
pUnit unit to copy properties from
constructor copies frameCount, channelCount and rate but not unit name

FFTUnit::FFTUnit ( const data::Values &  pValues  )  throw (SynthException)

values based constructor

Parameters:
pValues unit values
Exceptions:
SynthException failed to create unit
pValues structure & data types: 0: const String& : unit name 1: FunctionType : window type 2: unsigned int : number of window overlaps 3: unsigned int : number of frames 4: unsigned int : number of channels 5: unsigned int : samping rate

FFTUnit::~FFTUnit (  )  [virtual]

destructor


Member Function Documentation

void FFTUnit::process ( Buffer pBuffer  )  throw (SynthException) [virtual]

processes buffer

Parameters:
pBuffer buffer to process

Reimplemented from iso::synth::ProcessUnit.

base::String FFTUnit::info ( bool  pPropagate = false,
bool  pShowPorts = true 
) const [virtual]

obtain textual unit information

Parameters:
pPropagate if true, the unit calls the info methods of its input ports
pShowPorts print port information
Returns:
String containing unit information

Reimplemented from iso::synth::ProcessUnit.

void FFTUnit::init (  )  [protected]

initializes ports


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  pOstream,
const FFTUnit pUnit 
) [friend]

print unit information


Member Data Documentation

const base::String FFTUnit::sClassName [static]

default name

Reimplemented from iso::synth::ProcessUnit.

unsigned int FFTUnit::sUnitCount [static, protected]

total number of units created so far

Reimplemented from iso::synth::ProcessUnit.

FunctionType FFTUnit::sWindowType [static, protected]

default window type for windowing

Buffer* iso::synth::FFTUnit::mAudioBuffer [protected]

audio buffer

FunctionType iso::synth::FFTUnit::mWindowType [protected]

window type for windowing

Channel* iso::synth::FFTUnit::mWindow [protected]

window buffer

unsigned int iso::synth::FFTUnit::mOverlap [protected]

number of overlaps

unsigned int iso::synth::FFTUnit::mSpectraCount [protected]

total number of spectra per audio buffer

unsigned int iso::synth::FFTUnit::mSpectrumStartNr [protected]

first spectrum number

unsigned int iso::synth::FFTUnit::mSpectrumNr [protected]

current spectrum number

sample* iso::synth::FFTUnit::mFFTWAudioData [protected]

audio data buffer for fftw

fftwf_complex* iso::synth::FFTUnit::mFFTWSpectralData [protected]

spectral data buffer for fftw

RingBuffer* iso::synth::FFTUnit::mPreFFTAudioBuffer [protected]

audio buffer which combines audio buffers before fft

Frame iso::synth::FFTUnit::mPreFFTBufferReadPos [protected]

relative read position into PreFFTRingBuffer

fftwf_plan iso::synth::FFTUnit::mFFTPlan [protected]

forward fft plan


The documentation for this class was generated from the following files:
Generated on Fri Feb 25 14:18:45 2011 for synth by  doxygen 1.5.1