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

#include <WSOLA.H>

Inheritance diagram for WSOLA:
[legend]
Collaboration diagram for WSOLA:
[legend]

Public Member Functions

 WSOLA ()
 
 WSOLA (int chCnt)
 
virtual ~WSOLA ()
 Destructor. More...
 
template<typename Derived >
int process (FP_TYPE timeScale, const DenseBase< Derived > &input)
 
void processInner (void)
 
int getMaxInputSamplesRequired (void)
 
int getSamplesRequired (void)
 
int getOutputSize (void)
 
void reset (int chCnt)
 
int noMoreAudio ()
 
int loadInput (int n, int m, FP_TYPE val)
 
FP_TYPE unloadOutput (int n, int m)
 
void setFS (float fsIn)
 

Public Attributes

Array< FP_TYPE, Dynamic, Dynamic > output
 The output vector, each row is a channel. More...
 
Array< FP_TYPE, Dynamic, Dynamic > input
 The input vector, each row is a channel. More...
 

Private Member Functions

template<typename Derived >
int findSimilarityInBuffer (const DenseBase< Derived > &buffer)
 
template<typename Derived >
FP_TYPE findSimilarity (const ArrayBase< Derived > &outputIn)
 
template<typename Derived >
FP_TYPE rms (const ArrayBase< Derived > &s)
 
void OLAWnd (void)
 Generate the overlap add window based on the window size N. More...
 
void init (void)
 

Private Attributes

float fs
 The sample rate in Hz. More...
 
int N
 The size of the window. More...
 
int NO2
 Half the window size. More...
 
int M
 The number of windows in the search buffer. More...
 
int m
 The current row index into the buffer. More...
 
double rem
 The remainder fraction of a sample to remember for next time (can't move on by fractions of a sample). More...
 
Array< FP_TYPE, Dynamic, Dynamic > buffer
 The buffer of audio, each channel on its own row. More...
 
Array< FP_TYPE, Dynamic, Dynamic > wnd
 The overlap add window. More...
 
Array< FP_TYPE, Dynamic, Dynamic > nextOutput
 The output vector to search for, each channel per row. More...
 
Array< FP_TYPE, Dynamic, Dynamic > simComp
 Temporary vector used for computation. More...
 
int inputSamplesRequired
 The number of audio samples required for the next call to process. More...
 

Detailed Description

Class which implements the Waveform Similarity Overlap Add (Embedded WSOLA).

This class allows you to time scale modify multi-channel audio. It speeds up or slows down audio without changing its pitch.

This Class uses Eigen to compute all vector operations in the aim of ensuring efficient hardware utilisation and speed.

Definition at line 82 of file WSOLA.H.

Constructor & Destructor Documentation

◆ WSOLA() [1/2]

WSOLA::WSOLA ( )

Constructor, initialises the window size and buffer. Uses a default channel count.

Definition at line 21 of file WSOLA.C.

Here is the call graph for this function:

◆ WSOLA() [2/2]

WSOLA::WSOLA ( int  chCnt)

Constructor, initialises the window size and buffer. int chCnt The number of channels to use.

Definition at line 27 of file WSOLA.C.

Here is the call graph for this function:

◆ ~WSOLA()

WSOLA::~WSOLA ( )
virtual

Destructor.

Definition at line 33 of file WSOLA.C.

Member Function Documentation

◆ findSimilarity()

template<typename Derived >
FP_TYPE WSOLA::findSimilarity ( const ArrayBase< Derived > &  outputIn)
inlineprivate

Method to find the similarity between an output vector and the nextOutput.

Parameters
outputInThe vector to compare against the reference
Template Parameters
DerivedThe CRTP class operated on.

Definition at line 112 of file WSOLA.H.

Here is the caller graph for this function:

◆ findSimilarityInBuffer()

template<typename Derived >
int WSOLA::findSimilarityInBuffer ( const DenseBase< Derived > &  buffer)
private

Find the most similar vector in a buffer of vectors to the input reference.

Parameters
bufferThe matrix of vectors to compare against the reference
Template Parameters
DerivedThe CRTP class operated on.

Definition at line 57 of file WSOLA.C.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMaxInputSamplesRequired()

int WSOLA::getMaxInputSamplesRequired ( void  )
inline

Find out what the largest possible request of input samples

Definition at line 207 of file WSOLA.H.

Here is the caller graph for this function:

◆ getOutputSize()

int WSOLA::getOutputSize ( void  )
inline

Get the number of samples returned for each process.

Definition at line 220 of file WSOLA.H.

Here is the caller graph for this function:

◆ getSamplesRequired()

int WSOLA::getSamplesRequired ( void  )
inline

Get the number of input samples WSOLA requires as input to process.

Returns
The number of required samples

Definition at line 214 of file WSOLA.H.

Here is the caller graph for this function:

◆ init()

void WSOLA::init ( void  )
private

Initialise the system.

Definition at line 36 of file WSOLA.C.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadInput()

int WSOLA::loadInput ( int  n,
int  m,
FP_TYPE  val 
)

Load the WSOLA.input Array - for use with languages where Eigen types aren't exposed. Implements WSOLA.input(n,m)=val;

Parameters
nThe row to load
mThe column to load
valThe value to load into the input Array
Returns
<0 on error.

Definition at line 145 of file WSOLA.C.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ noMoreAudio()

int WSOLA::noMoreAudio ( )
inline

Indicate that there is no more input audio to process, begin rolling out the last of the buffer.

Returns
<= 0 to stop, any other number to continue.

Definition at line 233 of file WSOLA.H.

Here is the caller graph for this function:

◆ OLAWnd()

void WSOLA::OLAWnd ( void  )
private

Generate the overlap add window based on the window size N.

Definition at line 44 of file WSOLA.C.

Here is the caller graph for this function:

◆ process()

template<typename Derived >
int WSOLA::process ( FP_TYPE  timeScale,
const DenseBase< Derived > &  input 
)
inline

Process the input vector and indicate how many samples are required to reload the input vector.

Parameters
timeScaleThe scaling factor for the time, <1 is slower, >1 is faster
inputThe input to load into the buffer for future use.
Returns
the number of samples required
Template Parameters
DerivedThe CRTP class operated on.

Definition at line 169 of file WSOLA.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processInner()

void WSOLA::processInner ( void  )

The inner process. Find the most similar block to the desired and overlap add.

Definition at line 102 of file WSOLA.C.

Here is the call graph for this function:

◆ reset()

void WSOLA::reset ( int  chCnt)

Reset the system to start fresh.

Parameters
chCntThe number of channels to use.

Definition at line 135 of file WSOLA.C.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rms()

template<typename Derived >
FP_TYPE WSOLA::rms ( const ArrayBase< Derived > &  s)
inlineprivate

Method to return the RMS power of the input vector/matrix

Parameters
sThe matrix or vector to find the 2 Norn of
Returns
The RMS (2 Norm) of s
Template Parameters
DerivedThe CRTP class operated on.

Definition at line 124 of file WSOLA.H.

◆ setFS()

void WSOLA::setFS ( float  fsIn)

Set the sample rate in Hz

Parameters
fsInThe new sample rate in Hz

Definition at line 162 of file WSOLA.C.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unloadOutput()

FP_TYPE WSOLA::unloadOutput ( int  n,
int  m 
)

Unload the WSOLA.output Array - for use with languages where Eigen types aren't exposed. The value is returned.

Parameters
nThe row to unload
mThe column to unload
Returns
<0. on error or the value of WSOLA.output(n,m).

Definition at line 154 of file WSOLA.C.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ buffer

Array<FP_TYPE, Dynamic , Dynamic> WSOLA::buffer
private

The buffer of audio, each channel on its own row.

Definition at line 92 of file WSOLA.H.

◆ fs

float WSOLA::fs
private

The sample rate in Hz.

Definition at line 84 of file WSOLA.H.

◆ input

Array<FP_TYPE, Dynamic, Dynamic> WSOLA::input

The input vector, each row is a channel.

Definition at line 142 of file WSOLA.H.

◆ inputSamplesRequired

int WSOLA::inputSamplesRequired
private

The number of audio samples required for the next call to process.

Definition at line 134 of file WSOLA.H.

◆ M

int WSOLA::M
private

The number of windows in the search buffer.

Definition at line 88 of file WSOLA.H.

◆ m

int WSOLA::m
private

The current row index into the buffer.

Definition at line 89 of file WSOLA.H.

◆ N

int WSOLA::N
private

The size of the window.

Definition at line 86 of file WSOLA.H.

◆ nextOutput

Array<FP_TYPE, Dynamic, Dynamic> WSOLA::nextOutput
private

The output vector to search for, each channel per row.

Definition at line 96 of file WSOLA.H.

◆ NO2

int WSOLA::NO2
private

Half the window size.

Definition at line 87 of file WSOLA.H.

◆ output

Array<FP_TYPE, Dynamic, Dynamic> WSOLA::output

The output vector, each row is a channel.

Definition at line 141 of file WSOLA.H.

◆ rem

double WSOLA::rem
private

The remainder fraction of a sample to remember for next time (can't move on by fractions of a sample).

Definition at line 90 of file WSOLA.H.

◆ simComp

Array<FP_TYPE, Dynamic, Dynamic> WSOLA::simComp
private

Temporary vector used for computation.

Definition at line 98 of file WSOLA.H.

◆ wnd

Array<FP_TYPE, Dynamic, Dynamic> WSOLA::wnd
private

The overlap add window.

Definition at line 94 of file WSOLA.H.


The documentation for this class was generated from the following files:
gtkIOStream: WSOLA Class Reference
GTK+ IOStream  Beta