Real-time spectrum analyzer for ST Nucleo F401RE using Seeed Studio 2.8'' TFT Touch Shield V2.0.

Dependencies:   SeeedStudioTFTv2 UITDSP_ADDA 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 "PeakHolder.hpp"
00012 #include "LinearPrediction.hpp"
00013 
00014 namespace Mikami
00015 {
00016     class LpcAnalyzer
00017     {
00018     public:
00019         LpcAnalyzer(int nData, int order, int nFft);
00020         ~LpcAnalyzer();
00021         void Execute(float xn[], float db[]);
00022     private:
00023         const int N_DATA_;
00024         const int ORDER_;
00025         const int N_FFT_;
00026 
00027         HammingWindow hm_;
00028         LinearPred lp_;
00029         FftReal fft_;
00030         PeakHolder* pkHolder_;
00031 
00032         float* xData_;   // Data to be analyzed
00033         float* an_;
00034         float* xFft_;    // Input for FFT
00035         Complex* yFft_;  // Output of FFT
00036         float* normY_;   // Powerspectrum
00037 
00038         float Sqr(float x) { return x*x; }
00039     };
00040 }
00041 #endif  // LPC_ANALYZER_HPP
00042