Gamma  0.9.5
Generic Synthesis Library
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
STFT Class Reference

Short-time Fourier transform. More...

#include <DFT.h>

Inheritance diagram for STFT:
DFT DFTBase< float > Synced Node2< Synced >

List of all members.

Public Member Functions

 STFT (uint32_t winSize=1024, uint32_t hopSize=256, uint32_t padSize=0, WindowType winType=RECTANGLE, SpectralType specType=COMPLEX, uint32_t numAux=0)
bool operator() (float input)
 Input next time-domain sample.
void forward (const float *src)
 Perform forward transform of an array of samples.
virtual void inverse (float *dst)
 Get inverse transform using current spectral frame.
void resize (uint32_t winSize, uint32_t padSize)
 Set window and zero-padding size, in samples.
STFTinverseWindowing (bool v)
 Whether to apply a triangular window to inverse transform samples.
STFTrotateForward (bool v)
 Whether to rotate input samples by half.
STFTsizeHop (uint32_t size)
 Set hop size, in samples.
STFTwindowType (WindowType type)
 Set window type.
float * phases ()
 Returns array of phases if the sample data type is MAG_FREQ.
DFTspectrumType (SpectralType v)
 Set format of spectrum data.
DFTprecise (bool whether)
 Set whether to use precise (but slower) for converting to polar.
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.
SyncsyncHop ()
 Hop rate synchronizer.
float operator() ()
 Returns next sample from inverse transform.
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.
SyncsyncFreq ()
 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 Syncsync () 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

SyncednodeL
 Pointer to left node.
SyncednodeR
 Pointer to right node.

Protected Member Functions

void initSynced ()
 To be called from the constructor(s) of derived classes.

Detailed Description

Short-time Fourier transform.

The short-time Fourier transform uses a sliding window during analysis to obtain better time resolution between successive spectral frames. The resolution within each individual spectral frame is still determined by the window size.


Constructor & Destructor Documentation

STFT ( uint32_t  winSize = 1024,
uint32_t  hopSize = 256,
uint32_t  padSize = 0,
WindowType  winType = RECTANGLE,
SpectralType  specType = COMPLEX,
uint32_t  numAux = 0 
)
Parameters:
[in]winSizeNumber of samples to window
[in]hopSizeNumber of samples between successive windows
[in]padSizeNumber of zeros to append to window
[in]winTypeType of forward transform window
[in]specTypeFormat of spectrum data
[in]numAuxNumber of auxiliary buffers to create

Member Function Documentation

bool inverseOnNext ( ) [inherited]

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, inherited]

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 >.

float operator() ( ) [inherited]

Returns next sample from inverse transform.

The inverse transform is performed every sizeWin() samples.

bool operator() ( float  input)

Input next time-domain sample.

Returns:
whether a new spectral frame is available

Reimplemented from DFT.


The documentation for this class was generated from the following files: