00001 /* AudioPreprocessing.h 00002 * 00003 * Copyright (C) 2003 -- Timo Glaser 00004 */ 00005 00006 #ifndef AUDIOPREPROCESSING_H 00007 #define AUDIOPREPROCESSING_H 00008 00009 #include <fstream> 00010 00011 #include <audio/fft.h> 00012 #include <audio/AUFile.h> 00013 00014 #include <vector> 00015 00016 #include <stdio.h> 00017 #include <math.h> 00018 00019 00028 class 00029 AudioPreprocessing { 00030 public: 00033 AudioPreprocessing (void); 00034 00037 ~AudioPreprocessing (void); 00038 00043 AudioPreprocessing (AudioPreprocessing& source); 00044 00053 AudioPreprocessing (double interleaving, int factor, int noWindows, 00054 int noData); 00055 00060 void save (fstream& fs) const; 00061 00068 bool load (fstream& fs); 00069 00080 void createData (AUFile *auData); 00081 00086 const vector<double>& getWindows(void) const; 00087 00092 const vector<double>& getFFTEnergies (void) const; 00093 00099 void setInterleaving (double interleaving); 00100 00105 double getInterleaving (void) const; 00106 00111 void setFactor (int factor); 00112 00117 double getFactor (void) const; 00118 00123 void setNoWindows (int noWindows); 00124 00129 int getNoWindows (void) const; 00130 00131 00132 private: 00135 double interleaving; 00136 00140 double factor; 00141 00144 int noWindows; 00145 00148 int noData; 00149 00152 double * data; 00153 00156 vector<double> window; 00157 00161 vector<double> energy; 00162 00167 double sum (void); 00168 00173 int sizeOfFirstWindow (void); 00174 00177 void createWindows (void); 00178 00181 void scaleWindows (void); 00182 00185 void createFFTEnergies (void); 00186 00193 int getFactorIndex (double value) const; 00194 }; 00195 00196 #endif 00197