MelBands Class Reference

Algorithm to get the band values of Mel-scale frequency warpped magnitude spectrums. More...

#include <MelBands.h>

Collaboration diagram for MelBands:

Collaboration graph
[legend]

List of all members.

Public Types

enum  ScaleType { STEVENS = 0, FANT = 1, GREENWOOD = 2 }
 Specifies the type of the scale used. More...

Public Member Functions

 MelBands (Real lowFrequency=50.0, Real highFrequency=6000.0, int bandCount=40, Real samplerate=44100.0, int fftSize=1024, ScaleType scaleType=GREENWOOD)
void process (const MatrixXR &spectrums, MatrixXR *bands)
std::vector< MatrixXR > weights () const
void bandWeights (int band, MatrixXR *bandWeights) const
void starts (MatrixXI *result) const
int bands () const
void centers (MatrixXR *result) const
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)


Detailed Description

Algorithm to get the band values of Mel-scale frequency warpped magnitude spectrums.

This class represents an object to Mel bands on vectors of Real values. This method is a special case of the Bands algorithm and is used in many other spectral algorithms such as MFCC and SpectralWhitening.

The method consists in a set triangular 50% overlapping windows spaced evenly on a Mel-frequency scale.

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 bands is specified using setBandCount().

Author:
Ricard Marxer
See also:
Bands, MFCC, SpectralWhitening

Member Enumeration Documentation

enum ScaleType

Specifies the type of the scale used.

See also:
scaleType
Enumerator:
STEVENS  Mel scales computed using the original formula proposed by:

Stevens, Stanley Smith; Volkman; John; & Newman, Edwin. (1937). A scale for the measurement of the psychological magnitude of pitch. Journal of the Acoustical Society of America, 8 (3), 185-190.

FANT  Mel scales computed using the formula proposed by:

Fant, Gunnar. (1968). Analysis and synthesis of speech processes. In B. Malmberg (Ed.), Manual of phonetics (pp. 173-177). Amsterdam: North-Holland.

GREENWOOD  Mel scales computed using the Greenwood function:

Greenwood, DD. (1990) A cochlear frequency-position function for several species - 29 years later, Journal of the Acoustical Society of America, vol. 87, pp. 2592-2605.


Constructor & Destructor Documentation

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

Constructs a Mel bands object with the specified lowFrequency, highFrequency, bandCount, samplerate, fftSize 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.
scaleType scale used for the frequency warping.

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


Member Function Documentation

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

Calculates the bands of spectrums.

Parameters:
spectrums matrix of Real values.
bands pointer to a matrix of Real values for the output. The matrix should have the same number of rows as spectrums and as many columns as the number of bands as specified by bandCount.
Note that if the output matrix is not of the required size it will be resized, reallocating a new memory space if necessary.

References Bands::process().

Referenced by SpectralWhitening::process(), and MFCC::process().

std::vector< MatrixXR > weights (  )  const

Return the vector of weights.

See also:
starts, bandWeights, setStartsWeights

References Bands::weights().

void bandWeights ( int  band,
MatrixXR *  bandWeights 
) const

Return in bandWeights the weights of the band given by the index band.

See also:
weights

References Bands::bandWeights().

void starts ( MatrixXI *  result  )  const

Return in result the single column matrix of start indices of the bands.

References Bands::starts().

int bands (  )  const

Return number of bands.

References Bands::bands().

void centers ( MatrixXR *  result  )  const

Return in result the single column matrix of center fractional indices of the bands.

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 MelBands().

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 MelBands().

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 MelBands().

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 MelBands().

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 MelBands().

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 MelBands().


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