Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: F746_GUI F746_SAI_IO UIT_FFT_Real
Fork of F746_Spectrogram by
MyClasses_Functions/AnalysisBase.cpp
- Committer:
- MikamiUitOpen
- Date:
- 2016-05-22
- Revision:
- 0:9470a174c910
- Child:
- 2:1f092ac020e1
File content as of revision 0:9470a174c910:
//-------------------------------------------------------
//  Base class for spectrum analysis
//
//  2016/05/14, Copyright (c) 2015 MIKAMI, Naoki
//-------------------------------------------------------
#include "AnalysisBase.hpp"
namespace Mikami
{
    AnalyzerBase::AnalyzerBase(int nData, int nFft, int nUse)
        : N_DATA_(nData), N_FFT_(nFft),
          fft_(nFft), wHm_(nData-1, nUse),
          xData_(new float[nUse]), wData_(new float[nUse]) {}
    AnalyzerBase::~AnalyzerBase()
    {
        delete[] xData_;
    }
    void AnalyzerBase::Execute(const float xn[], float db[])
    {
        // Differencing
        for (int n=0; n<N_DATA_-1; n++)
            xData_[n] = xn[n+1] - 0.8f*xn[n];
            
        // Windowing (FFT, cepstrum: + zero-padding)
        wHm_.Execute(xData_, wData_);
            
        // Pure virtual function for analyzing
        Analyze(wData_, db);
    }
}
            
    