Integrated program of 4 different kinds of application programs for processing sound signal. 4種類のサウンド信号処理を統合したプログラム.
Dependencies: F746_GUI F746_SAI_IO FrequencyResponseDrawer SD_PlayerSkeleton UIT_FFT_Real
MyAcousticEffector_MIC/Biquad.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2016-08-15
- Revision:
- 0:224dccbc4edd
- Child:
- 5:0e14065569ea
File content as of revision 0:224dccbc4edd:
//-------------------------------------------------------------- // 縦続形 IIR フィルタで使う 1D タイプの 2 次のフィルタ // Biquad filter of 1D type for IIR filter of cascade structure // このクラスでは,係数は実行中に書き換えられることを想定している // // u[n] = x[n] + a1*u[n-1] + a2*u[n-2] // y[n] = u[n] + b1*u[n-1] + b2*u[n-2] // x[n] : input signal // y[n] : output signal // b0 = 1 // // 2016/03/25, Copyright (c) 2016 MIKAMI, Naoki //-------------------------------------------------------------- #ifndef IIR_BIQUAD_HPP #define IIR_BIQUAD_HPP #include "mbed.h" // 2nd order IIR filter namespace Mikami { class Biquad { public: struct Coefs { float a1, a2, b1, b2; }; Biquad() {} // Default constructore Biquad(const Coefs ck) { SetCoefficients(ck); Clear(); } void SetCoefficients(const Coefs ck) { a1_ = ck.a1; a2_ = ck.a2; b1_ = ck.b1; b2_ = ck.b2; } float Execute(float xn) { float un = xn + a1_*un1_ + a2_*un2_; float yn = un + b1_*un1_ + b2_*un2_; un2_ = un1_; un1_ = un; return yn; } void Clear() { un1_ = un2_ = 0; } private: float a1_, a2_, b1_, b2_; float un1_, un2_; // disallow copy constructor Biquad(const Biquad&); }; } #endif // IIR_BIQUAD_HPP