SpectralWhitening Class Reference

Algorithm to whiten the magnitude of spectrums represented as vectors of Real values. More...

#include <SpectralWhitening.h>

Collaboration diagram for SpectralWhitening:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 SpectralWhitening (int fftSize=1024, Real lowFrequency=50.0, Real highFrequency=6000.0, Real samplerate=44100.0, Real compressionFactor=0.33, int bandCount=40, MelBands::ScaleType scaleType=MelBands::GREENWOOD)
 ~SpectralWhitening ()
void process (const MatrixXR &spectrums, MatrixXR *whitened)
int bandCount () const
void setBandCount (int count, bool callSetup=true)
Real lowFrequency () const
void setLowFrequency (Real frequency, bool callSetup=true)
Real highFrequency () const
void setHighFrequency (Real frequency, bool callSetup=true)
Real samplerate () const
void setSamplerate (Real frequency, bool callSetup=true)
int fftSize () const
void setFftSize (int size, bool callSetup=true)
MelBands::ScaleType scaleType () const
void setScaleType (MelBands::ScaleType type, bool callSetup=true)
Real compressionFactor () const
void setCompressionFactor (Real factor, bool callSetup=true)


Detailed Description

Algorithm to whiten the magnitude of spectrums represented as vectors of Real values.

This class represents an object to perform spectral whitening on vectors of Real values. Which is a useful technique to make the peaks of a spectrum magnitude stand out in harmonic sounds.

This implementation consists in calculating the Mel bands and create a linear interpolation between these to be used as a wheighting parameter of the spectrum's compression.

The samplerate and FFT size of the input spectrum are specified using setSamplerate() and setFftSize().

The frequency limits of the Mel scale mapping are specified using setLowFrequency() and setHighFrequency().

The number of Mel bands is specified using setBandCount().

The compression factor of the whitening process is specified by setCompressionFactor().

Author:
Ricard Marxer
See also:
MelBands, Bands, PeakDetection

Constructor & Destructor Documentation

SpectralWhitening ( int  fftSize = 1024,
Real  lowFrequency = 50.0,
Real  highFrequency = 6000.0,
Real  samplerate = 44100.0,
Real  compressionFactor = 0.33,
int  bandCount = 40,
MelBands::ScaleType  scaleType = MelBands::GREENWOOD 
)

Constructs a spectral whitening object with the specified lowFrequency, highFrequency, bandCount, samplerate, fftSize, compressionFactor and scaleType settings.

Parameters:
lowFrequency frequency of the lowest Mel band, must be greater than zero 0 and lower than half the samplerate.
highFrequency frequency of the highest Mel band, must be greater than zero 0 and lower than half the samplerate.
bandCount number of Mel bands.
samplerate samplerate frequency of the input signal.
fftSize size of the FFT.
compressionFactor factor of the compression process in the whitening.
scaleType scale used for the frequency warping.

References setBandCount(), setCompressionFactor(), setFftSize(), setHighFrequency(), setLowFrequency(), setSamplerate(), and setScaleType().

Destroys the algorithm and frees its resources.


Member Function Documentation

void process ( const MatrixXR &  spectrums,
MatrixXR *  whitened 
)

Performs a whitening on each of the rows of spectrums. Puts the resulting whitened spectrum in the rows of whitened.

Parameters:
spectrums matrix of Real values representing one spectrum magnitude per row. The number of columns of spectrum must be equal to the fftSize / 2 + 1 where fftSize is specified using setFftSize().
whitened pointer to a matrix of Real values representing one whitened spectrum per row. The matrix should have the same number of rows and columns as spectrums.
Note that if the output matrices are not of the required sizes they will be resized, reallocating a new memory space if necessary.

References MelBands::process().

int bandCount (  )  const

Returns the number of bands to be performed. The default is 40.

See also:
setBandCount()

void setBandCount ( int  count,
bool  callSetup = true 
)

Specifies the count of bands to be performed.

See also:
bandCount()

Referenced by SpectralWhitening().

Real lowFrequency (  )  const

Return the low frequency of the spectral whitening. The default is 50.0.

See also:
lowFrequency, highFrequency, setLowFrequency, setHighFrequency

void setLowFrequency ( Real  frequency,
bool  callSetup = true 
)

Specifies the low frequency of the spectral whitening. The given frequency must be in the range of 0 to the samplerate / 2.

See also:
lowFrequency, highFrequency, setHighFrequency

Referenced by SpectralWhitening().

Real highFrequency (  )  const

Return the high frequency of the spectral whitening. The default is 6000.0.

See also:
lowFrequency, setLowFrequency, setHighFrequency

void setHighFrequency ( Real  frequency,
bool  callSetup = true 
)

Specifies the high frequency of the spectral whitening. The given frequency must be in the range of 0 to the samplerate / 2.

See also:
lowFrequency, highFrequency, setLowFrequency

Referenced by SpectralWhitening().

Real samplerate (  )  const

Return the samplerate frequency of the input signal. The default is 44100.0.

See also:
setSamplerate

void setSamplerate ( Real  frequency,
bool  callSetup = true 
)

Specifies the samplerate frequency of the input signal.

See also:
samplerate

Referenced by SpectralWhitening().

int fftSize (  )  const

Returns the size of the FFT that has been performed for the input. The default is 1024.

See also:
setFftSize()

void setFftSize ( int  size,
bool  callSetup = true 
)

Specifies the size of the FFT that has been performed for the input. The given size must be higher than 0.

See also:
fftSize()

Referenced by SpectralWhitening().

MelBands::ScaleType scaleType (  )  const

Return the type of the frequency warping scale.

By default it is GREENWOOD.

See also:
setScaleType()

void setScaleType ( MelBands::ScaleType  type,
bool  callSetup = true 
)

Specify the type of the frequency warping scale.

See also:
scaleType()

Referenced by SpectralWhitening().

Real compressionFactor (  )  const

Return the compression factor of the whitening. The default is 0.33.

See also:
setCompressionFactor

void setCompressionFactor ( Real  factor,
bool  callSetup = true 
)

Specifies the compression factor of the whitening.

See also:
compressionFactor

Referenced by SpectralWhitening().


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

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