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/AnalyzerBase.cpp

Committer:
MikamiUitOpen
Date:
2017-02-17
Revision:
0:a539141b9dec
Child:
6:c38ec7939609

File content as of revision 0:a539141b9dec:

//-------------------------------------------------------
//  Base abstract class for spectrum analysis
//
//  2017/02/09, Copyright (c) 2017 MIKAMI, Naoki
//-------------------------------------------------------

#include "AnalyzerBase.hpp"

namespace Mikami
{
    AnalyzerBase::AnalyzerBase(int nData, int nFft, int nUse)
        : N_DATA_(nData), N_FFT_(nFft),
          fft_(nFft), wHm_(nData-1, nUse), b1_(1.0f),
          xData_(nUse), wData_(nUse) {}

    void AnalyzerBase::Execute(const float xn[], float db[])
    {
        // 高域強調
        for (int n=0; n<N_DATA_-1; n++)
            xData_[n] = xn[n+1] - b1_*xn[n];
            
        // 窓掛け
        wHm_.Execute(xData_, wData_);
            
        Analyze(wData_, db);
    }
}