Resample Class Reference

Algorithm to resample vectors represented as vectors of Real values. More...

#include <Resample.h>

List of all members.

Public Types

enum  ResamplingMethod {
  SINC_BEST_QUALITY = 0, SINC_MEDIUM_QUALITY = 1, SINC_FASTEST = 2, ZERO_ORDER_HOLD = 3,
  LINEAR = 4
}
 Specifies the resampling method to be used. More...

Public Member Functions

 Resample (int inputSize=1024, int outputSize=1024, Real resamplingRatio=1.0, ResamplingMethod resamplingMethod=SINC_BEST_QUALITY)
 ~Resample ()
void process (const MatrixXR &frames, MatrixXR *resampled)
int inputSize () const
void setInputSize (int size, bool callSetup=true)
int outputSize () const
void setOutputSize (int size, bool callSetup=true)
Real resamplingRatio () const
void setResamplingRatio (Real ratio, bool callSetup=true)
ResamplingMethod resamplingMethod () const
void setResamplingMethod (ResamplingMethod method, bool callSetup=true)


Detailed Description

Algorithm to resample vectors represented as vectors of Real values.

This class represents an object to resample vectors of Real values. The algorithm takes as input N-point vectors of Real values and returns M-point vectors of Real values.

This algorithm changes the sampling rate of input vectors, modifying their number of samples.

The number of samples in the input and output vectors can be specified using setInputSize() and setOutputSize() respectively.

The ratio between the output and input sampling rates can be specified using setResamplingRatio(). Usually the sampling ratio will be chosen close to outputSize / inputSize.

Author:
Ricard Marxer
See also:
FFT

Member Enumeration Documentation

Specifies the resampling method to be used.

See also:
resamplingMethod
Enumerator:
SINC_BEST_QUALITY  Best quality cardinal sine method
SINC_MEDIUM_QUALITY  Medium quality cardinal sine method
SINC_FASTEST  Fastest cardinal sine method
ZERO_ORDER_HOLD  Hold the value until the next sample
LINEAR  Linear interpolation between samples


Constructor & Destructor Documentation

Resample ( int  inputSize = 1024,
int  outputSize = 1024,
Real  resamplingRatio = 1.0,
ResamplingMethod  resamplingMethod = SINC_BEST_QUALITY 
)

Constructs a Resampler object with the specified inputSize, outputSize, resamplingRatio and resamplingMethod settings.

Parameters:
inputSize size of the input frames to be resampled, must be > 0.
outputSize size of the output resampled frames, must be > 0.
resamplingRatio the ratio between the output sampling rate and the input sampling rate
resamplingMethod the resampling method to be used

References setInputSize(), setOutputSize(), setResamplingMethod(), and setResamplingRatio().

~Resample (  ) 

Destroys the algorithm and frees its resources.


Member Function Documentation

void process ( const MatrixXR &  frames,
MatrixXR *  resampled 
)

Performs the resampling of each of the rows of frames and puts the resulting resampled frames in the rows of resampled.

Parameters:
frames matrix of Real values. The number of columns of frames must be equal to the inputSize.
resampled pointer to a matrix of Real values for the output. The matrix should have the same number of rows as frames and outputSize columns.
Note that if the output matrix is not of the required size it will be resized, reallocating a new memory space if necessary.

int inputSize (  )  const

Returns the input size of the algorithm.

By default it is 1024.

void setInputSize ( int  size,
bool  callSetup = true 
)

Specifies the input size of the algorithm.

Referenced by Resample().

int outputSize (  )  const

Returns the output size of the algorithm.

By default it is 1024.

void setOutputSize ( int  size,
bool  callSetup = true 
)

Specifies the output size of the algorithm.

Referenced by Resample().

Real resamplingRatio (  )  const

Returns the ratio between the output and input sampling rate. Note that this value is normally around outputSize / inputSize.

By default it is 1.0.

void setResamplingRatio ( Real  ratio,
bool  callSetup = true 
)

Specifies the ratio between the output and input sampling rate.

Referenced by Resample().

Resample::ResamplingMethod resamplingMethod (  )  const

Returns the resampling method to be used.

By default it is SINC_BEST_QUALITY.

void setResamplingMethod ( ResamplingMethod  method,
bool  callSetup = true 
)

Specifies the resampling method to be used.

Referenced by Resample().


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

Generated on Tue Mar 31 20:38:33 2009 for Loudia by  doxygen 1.5.6