No photo version of "F746_SpectralAnalysis_Example".

Dependencies:   BSP_DISCO_F746NG BUTTON_GROUP LCD_DISCO_F746NG TS_DISCO_F746NG UIT_FFT_Real mbed

SpactrumAnalysisClasses/LPC_Analysis.hpp

Committer:
MikamiUitOpen
Date:
2015-11-24
Revision:
0:9d7f931c704a

File content as of revision 0:9d7f931c704a:

//---------------------------------------------------------------
// Class for spectrum analysis using linear prediction (Header)
// Copyright (c) 2014 MIKAMI, Naoki,  2014/12/30
//---------------------------------------------------------------

#ifndef LPC_ANALYZER_HPP
#define LPC_ANALYZER_HPP

#include "fftReal.hpp"
#include "Hamming.hpp"
#include "LinearPrediction.hpp"

namespace Mikami
{
    class LpcAnalyzer
    {
    public:
        LpcAnalyzer(int nData, int order, int nFft);
        ~LpcAnalyzer();
        void Execute(float xn[], float db[]);
    private:
        const int N_DATA_;
        const int ORDER_;
        const int N_FFT_;

        HammingWindow hm_;
        LinearPred lp_;
        FftReal fft_;

        float* xData_;   // Data to be analyzed
        float* an_;
        float* xFft_;    // Input for FFT
        Complex* yFft_;  // Output of FFT
        float* normY_;   // Powerspectrum

        float Sqr(float x) { return x*x; }
    };
}
#endif  // LPC_ANALYZER_HPP