Discrete Fourier transform. More...
#include <DFT.h>
Public Member Functions | |
DFT (uint32_t winSize=1024, uint32_t padSize=0, SpectralType specType=COMPLEX, uint32_t numAux=0) | |
Constructor. | |
DFT & | spectrumType (SpectralType v) |
Set format of spectrum data. | |
DFT & | precise (bool whether) |
Set whether to use precise (but slower) for converting to polar. | |
void | resize (uint32_t windowSize, uint32_t padSize) |
Set size parameters of transform. | |
float | freqRes () const |
Get frequency resolution of analysis. | |
float | overlap () const |
Get transform overlap factor. | |
bool | overlapping () const |
Whether the transform is overlapping. | |
uint32_t | sizeHop () const |
Get size of hop. | |
uint32_t | sizePad () const |
Get size of zero-padding. | |
uint32_t | sizeWin () const |
Get size of window. | |
Sync & | syncHop () |
Hop rate synchronizer. | |
bool | operator() (float input) |
Reads next sample in for a forward transform. | |
float | operator() () |
Returns next sample from inverse transform. | |
void | forward (const float *src) |
Performs forward transform on a window of samples. | |
virtual void | inverse (float *dst) |
Performs inverse transform on internal spectrum. | |
bool | inverseOnNext () |
Returns true if next call to inverse() will perform the inverse transform. | |
void | zero () |
Zeroes internal frequency bins. | |
void | zeroEnds () |
Zeroes DC and Nyquist bins. | |
virtual void | onResync (double r) |
Called by my Sync reference after it changes its value. | |
float * | aux (uint32_t num) |
Get pointer to an auxiliary buffer. | |
Complex< float > * | bins () const |
Get pointer to bin data. | |
Complex< float > & | bin (uint32_t k) |
Get reference to bin value. | |
const Complex< float > & | bin (uint32_t k) const |
Get read-only reference to bin value. | |
double | binFreq () const |
Get width of frequency bins. | |
uint32_t | numBins () const |
Get number of frequency bins. | |
uint32_t | sizeDFT () const |
Get size of forward transform. | |
Sync & | syncFreq () |
Get frequency domain synchronizer. | |
void | numAux (uint32_t num) |
Sets number of auxilliary buffers, each of size numBins() | |
double | scaleSPU () const |
Returns ratio of my SPU to my Sync's SPU. | |
void | scaleSPU (double v) |
Scales samples/unit by factor. | |
double | spu () const |
Returns local samples/unit. | |
void | spu (double v) |
Set local samples/unit. | |
double | ups () const |
Returns local units/sample. | |
void | ups (double v) |
Set local units/sample. | |
const Sync * | sync () const |
Returns reference to my Sync. | |
void | sync (Sync &src) |
Set absolute Sync source. | |
void | scaleUPS (double v) |
Scales units/sample by factor. | |
void | nodeInsertL (Synced &node) |
Insert myself to left of node. | |
void | nodeInsertR (Synced &node) |
Insert myself to right of node. | |
void | nodeRemove () |
Remove myself from linked list. | |
Public Attributes | |
Synced * | nodeL |
Pointer to left node. | |
Synced * | nodeR |
Pointer to right node. | |
Protected Member Functions | |
void | initSynced () |
To be called from the constructor(s) of derived classes. |
Discrete Fourier transform.
DFT | ( | uint32_t | winSize = 1024 , |
uint32_t | padSize = 0 , |
||
SpectralType | specType = COMPLEX , |
||
uint32_t | numAux = 0 |
||
) |
Constructor.
[in] | winSize | Number of samples in window |
[in] | padSize | Number of zeros to append to window |
[in] | specType | Format of spectrum data |
[in] | numAux | Number of auxilliary buffers of size numBins() to create |
void forward | ( | const float * | src | ) |
void inverse | ( | float * | dst | ) | [virtual] |
Performs inverse transform on internal spectrum.
The resynthesized samples are copied into 'dst'. The destination array must have room for at least sizeDFT() number of elements. If 'dst' equals 0, then the resynthesized samples are not copied, but instead held in the internal transform buffer.
Reimplemented in STFT.
bool inverseOnNext | ( | ) |
Returns true if next call to inverse() will perform the inverse transform.
This method is used for doing inverse-only transforms. Basically, it tells you when you should set the frequency samples.
void onResync | ( | double | ratioSPU | ) | [virtual] |
Called by my Sync reference after it changes its value.
Any instance state that depends on the sampling length should be updated here.
Reimplemented from DFTBase< float >.
bool operator() | ( | float | input | ) |
float operator() | ( | ) |
Returns next sample from inverse transform.
The inverse transform is performed every sizeWin() samples.