Realtime spectrum analyzer. Using FFT, linear prediction, or cepstrum smoothing. Version using MEMS microphone and CODEC, named "F746_RealtimeSpectrumAnalyzer_MEMS_Mic" is registered. リアルタイム スペクトル解析器.解析の手法:FFT,線形予測法,ケプストラムによる平滑化の3種類.このプログラムの説明は,CQ出版社のインターフェース誌,2016年4月号に掲載.外付けのマイクまたは他の信号源等を A0 に接続する.線形予測法,ケプストラムは,スペクトル解析の対象を音声信号に想定してパラメータを設定している.MEMS マイクと CODEC を使ったバージョンを "F746_RealtimeSpectrumAnalyzer_MEMS_Mic" として登録.

Dependencies:   BSP_DISCO_F746NG BUTTON_GROUP LCD_DISCO_F746NG TS_DISCO_F746NG UIT_FFT_Real mbed

MyClasses/LinearPrediction.hpp

Committer:
MikamiUitOpen
Date:
2016-02-22
Revision:
18:6630d61aeb3c
Parent:
5:98ec9dd54144

File content as of revision 18:6630d61aeb3c:

//-----------------------------------------------------
//  Class for linear prediction (Header)
//
//  2015/12/15, Copyright (c) 2015 MIKAMI, Naoki
//-----------------------------------------------------

#ifndef LINEAR_PREDICTION_HPP
#define LINEAR_PREDICTION_HPP

#include "mbed.h"

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_;
        const uint16_t ORDER_;

        float* r_;  // for auto-correlation
        float* k_;  // for PARCOR coefficients
        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