00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SPECTRALWHITENING_H
00020 #define SPECTRALWHITENING_H
00021
00022 #include "Typedefs.h"
00023 #include "Debug.h"
00024
00025 #include "MelBands.h"
00026
00053 class SpectralWhitening {
00054 protected:
00055 int _fftSize;
00056 int _halfSize;
00057 Real _lowFrequency;
00058 Real _highFrequency;
00059
00060 Real _samplerate;
00061 Real _compressionFactor;
00062 int _bandCount;
00063
00064 MelBands::ScaleType _scaleType;
00065
00066 MatrixXR _centers;
00067
00068 MatrixXR _bandEnergy;
00069 MatrixXR _compressionWeights;
00070
00071 MelBands _bands;
00072
00073 public:
00094 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);
00095
00099 ~SpectralWhitening();
00100
00101 void setup();
00102 void reset();
00103
00118 void process(const MatrixXR& spectrums, MatrixXR* whitened);
00119
00126 int bandCount() const;
00127
00133 void setBandCount( int count, bool callSetup = true );
00134
00141 Real lowFrequency() const;
00142
00149 void setLowFrequency( Real frequency, bool callSetup = true );
00150
00157 Real highFrequency() const;
00158
00165 void setHighFrequency( Real frequency, bool callSetup = true );
00166
00173 Real samplerate() const;
00174
00180 void setSamplerate( Real frequency, bool callSetup = true );
00181
00188 int fftSize() const;
00189
00196 void setFftSize( int size, bool callSetup = true );
00197
00205 MelBands::ScaleType scaleType() const;
00206
00212 void setScaleType( MelBands::ScaleType type, bool callSetup = true );
00213
00220 Real compressionFactor() const;
00221
00227 void setCompressionFactor( Real factor, bool callSetup = true );
00228
00229 };
00230
00231 #endif