Realtime sound spectrogram using FFT or linear prediction. Spectrogram is displayed on the display of PC. リアルタイム・スペクトログラム.解析の手法:FFT,線形予測法.スペクトログラムは PC のディスプレー装置に表示される.PC 側のプログラム:F446_Spectrogram.

Dependencies:   Array_Matrix mbed SerialTxRxIntr F446_AD_DA UIT_FFT_Real

MySpectrogram/LinearPrediction.hpp

Committer:
MikamiUitOpen
Date:
2017-02-17
Revision:
0:a539141b9dec

File content as of revision 0:a539141b9dec:

//-----------------------------------------------------
//  Class for linear prediction (Header)
//
//  2017/02/11, Copyright (c) 2017 MIKAMI, Naoki
//-----------------------------------------------------

#ifndef LINEAR_PREDICTION_HPP
#define LINEAR_PREDICTION_HPP

#include "Array.hpp"

namespace Mikami
{
    class LinearPred
    {
    public:
        LinearPred(int nData, int order);
        ~LinearPred() {}
        bool Execute(const float x[], float a[], float &em);
    private:
        const uint16_t N_DATA_;

        uint16_t order_;

        Array<float> r_;    // for auto-correlation
        Array<float> k_;    // for PARCOR coefficients
        Array<float> am_;   // working area

        void AutoCorr(const float x[]);
        bool Durbin(float a[], float &em);

        // disallow copy constructor and assignment operator
        LinearPred(const LinearPred& );
        LinearPred& operator=(const LinearPred& );
    };
}
#endif  // LINEAR_PREDICTION_HPP