gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
OverlapAdd< TYPE > Class Template Reference

#include <OverlapAdd.H>

Inheritance diagram for OverlapAdd< TYPE >:
[legend]

Public Member Functions

 OverlapAdd (void)
 Empty constructor defaults to OVERLAP_DEFAULT. More...
 
 OverlapAdd (float factor)
 
virtual ~OverlapAdd ()
 Destructor. More...
 
int loadData (Sox< float > &sox, uint windowSize, uint sampleCount, int whichCh=0)
 
int unloadData (Sox< float > &sox)
 
float getOverlapFactor ()
 
float getWindowSize ()
 
float getWindowCount ()
 
void dump (void)
 
TYPE getMaxVal ()
 

Protected Attributes

Eigen::Matrix< TYPE, Eigen::Dynamic, Eigen::Dynamic > data
 

Private Member Functions

void init (float factor)
 

Private Attributes

float overlapFactor
 Overlap factor, 0.5 for half. More...
 

Detailed Description

template<class TYPE>
class OverlapAdd< TYPE >

Generates an overlap matrix for an arbitrary 1D waveform.

Allows specification of the overlap factor <1.

The audio is read in from any audio file supported by Sox. The loadData method will read in the number of samples specified and pad out the rest of the window with extra samples. The actual number of samples read in may be windowSize*getOverlapFactor() larger then requested.

Template Parameters
TYPESpecifies the type of the data held in the matrix, e.g. float, double
Examples:
OverlapAddTest.C.

Definition at line 60 of file OverlapAdd.H.

Constructor & Destructor Documentation

◆ OverlapAdd() [1/2]

template<class TYPE>
OverlapAdd< TYPE >::OverlapAdd ( void  )
inline

Empty constructor defaults to OVERLAP_DEFAULT.

Definition at line 84 of file OverlapAdd.H.

◆ OverlapAdd() [2/2]

template<class TYPE>
OverlapAdd< TYPE >::OverlapAdd ( float  factor)
inline

Constructor specifying an overlap factor.

Parameters
factorthe factor to overlap by.

Definition at line 91 of file OverlapAdd.H.

◆ ~OverlapAdd()

template<class TYPE>
virtual OverlapAdd< TYPE >::~OverlapAdd ( )
inlinevirtual

Destructor.

Definition at line 96 of file OverlapAdd.H.

Member Function Documentation

◆ dump()

template<class TYPE>
void OverlapAdd< TYPE >::dump ( void  )
inline

Method to print the contents window by window to stdout.

Definition at line 274 of file OverlapAdd.H.

◆ getMaxVal()

template<class TYPE>
TYPE OverlapAdd< TYPE >::getMaxVal ( )
inline

Get the absolute maximum value from the data.

Returns
The maximum value held in the data array max(max(abs(data))).

Definition at line 281 of file OverlapAdd.H.

◆ getOverlapFactor()

template<class TYPE>
float OverlapAdd< TYPE >::getOverlapFactor ( )
inline

find out by how much the windows are overlapping, 0.5 implies half window overlap.

Returns
the overlap factor

Definition at line 254 of file OverlapAdd.H.

◆ getWindowCount()

template<class TYPE>
float OverlapAdd< TYPE >::getWindowCount ( )
inline

Find how many windows of getWindowSize() samples are in memory.

Returns
the number of windows which are in memory.

Definition at line 268 of file OverlapAdd.H.

Here is the caller graph for this function:

◆ getWindowSize()

template<class TYPE>
float OverlapAdd< TYPE >::getWindowSize ( )
inline

Find how many samples in each window of data.

Returns
the number of samples in each window (block)

Definition at line 261 of file OverlapAdd.H.

Here is the caller graph for this function:

◆ init()

template<class TYPE>
void OverlapAdd< TYPE >::init ( float  factor)
inlineprivate

Initialise this class, specifying an overlap factor.

Parameters
factorthe factor to overlap by.

Definition at line 66 of file OverlapAdd.H.

◆ loadData()

template<class TYPE>
int OverlapAdd< TYPE >::loadData ( Sox< float > &  sox,
uint  windowSize,
uint  sampleCount,
int  whichCh = 0 
)
inline

load data into the data matrix, with each column containing windowSize samples and overlapping by windowSize*getOverlapFactor() samples. Note : this method will try to read an extra windowSize*getOverlapFactor() samples to fill the last window.

Parameters
soxAn open sox audiofile, positioned to the point to start reading from.
windowSizeThe size of the audio window including the overlapped region
sampleCountThe total number of samples to read from the input file.
whichChWhich channel to read from the input audio file.
Returns
The number of samples not read (when trying to read the last window) on success and the private data matrix is populated, the apropriate error otherwise.

Definition at line 121 of file OverlapAdd.H.

Here is the call graph for this function:

◆ unloadData()

template<class TYPE>
int OverlapAdd< TYPE >::unloadData ( Sox< float > &  sox)
inline

unload data from the data matrix to the Sox output file, with each column is windowed using windowSize*getOverlapFactor() samples.

Parameters
soxAn open sox audiofile, positioned to the point to start writing to.

Definition at line 182 of file OverlapAdd.H.

Here is the call graph for this function:

Member Data Documentation

◆ data

template<class TYPE>
Eigen::Matrix<TYPE, Eigen::Dynamic, Eigen::Dynamic> OverlapAdd< TYPE >::data
protected

The overlapping data is held in this matrix.

Template Parameters
TYPEThe Matrix types to input and return

Definition at line 79 of file OverlapAdd.H.

◆ overlapFactor

template<class TYPE>
float OverlapAdd< TYPE >::overlapFactor
private

Overlap factor, 0.5 for half.

Definition at line 61 of file OverlapAdd.H.


The documentation for this class was generated from the following file:
gtkIOStream: OverlapAdd< TYPE > Class Template Reference
GTK+ IOStream  Beta