不韋 呂 / Mbed 2 deprecated F746_SpectralAnalysis_NoPhoto

Dependencies:   BSP_DISCO_F746NG BUTTON_GROUP LCD_DISCO_F746NG TS_DISCO_F746NG UIT_FFT_Real mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LPC_Analysis.hpp Source File

LPC_Analysis.hpp

00001 //---------------------------------------------------------------
00002 // Class for spectrum analysis using linear prediction (Header)
00003 // Copyright (c) 2014 MIKAMI, Naoki,  2014/12/30
00004 //---------------------------------------------------------------
00005 
00006 #ifndef LPC_ANALYZER_HPP
00007 #define LPC_ANALYZER_HPP
00008 
00009 #include "fftReal.hpp"
00010 #include "Hamming.hpp"
00011 #include "LinearPrediction.hpp"
00012 
00013 namespace Mikami
00014 {
00015     class LpcAnalyzer
00016     {
00017     public:
00018         LpcAnalyzer(int nData, int order, int nFft);
00019         ~LpcAnalyzer();
00020         void Execute(float xn[], float db[]);
00021     private:
00022         const int N_DATA_;
00023         const int ORDER_;
00024         const int N_FFT_;
00025 
00026         HammingWindow hm_;
00027         LinearPred lp_;
00028         FftReal fft_;
00029 
00030         float* xData_;   // Data to be analyzed
00031         float* an_;
00032         float* xFft_;    // Input for FFT
00033         Complex* yFft_;  // Output of FFT
00034         float* normY_;   // Powerspectrum
00035 
00036         float Sqr(float x) { return x*x; }
00037     };
00038 }
00039 #endif  // LPC_ANALYZER_HPP
00040