Output the audio signal with filtering by IIR filter in the *.wav file on the SD card using onboard CODEC. SD カードの *.wav ファイルのオーディオ信号を遮断周波数可変の IIR フィルタを通して,ボードに搭載されているCODEC で出力する.

Dependencies:   BSP_DISCO_F746NG F746_GUI LCD_DISCO_F746NG SDFileSystem_Warning_Fixed TS_DISCO_F746NG mbed FrequencyResponseDrawer F746_SAI_IO Array_Matrix

Revision:
0:04b43b777fae
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MyClasses_Functions/BilinearDesignLH.hpp	Tue Apr 19 09:46:11 2016 +0000
@@ -0,0 +1,60 @@
+//------------------------------------------------------------------------------
+//  Design of Butterworth LPF and HPF using bilinear transform -- Header
+//
+//   2016/03/31, Copyright (c) 2016 MIKAMI, Naoki
+//------------------------------------------------------------------------------
+
+#ifndef BILINEAR_BUTTERWORTH_HPP
+#define BILINEAR_BUTTERWORTH_HPP
+
+#include "mbed.h"
+#include <complex>  // requisite
+
+namespace Mikami
+{
+    typedef complex<float> Complex; // define "Complex"
+
+    class BilinearDesign
+    {
+    public:
+        struct Coefs { float a1, a2, b1, b2; };
+        enum Type { LPF, HPF };
+
+        // Constructor
+        BilinearDesign(int order, float fs)
+            : PI_FS_(PI_/fs), ORDER_(order)
+        {
+            sP_ = new Complex[order/2];
+            zP_ = new Complex[order/2];
+            ck_ = new Coefs[order/2];
+        }
+
+        // Destractor
+        ~BilinearDesign()
+        {
+            delete[] sP_;
+            delete[] zP_;
+            delete[] ck_;
+        }
+
+        // Execution of design
+        void Execute(float fc, Type pb, Coefs c[], float& g);
+
+    private:
+        static const float PI_ = 3.1415926536f;
+        const float PI_FS_;
+        const int ORDER_;
+
+        Complex* sP_;   // Poles on s-plane
+        Complex* zP_;   // Poles on z-plane
+        Coefs* ck_;     // Coefficients of transfer function for cascade form
+        float gain_;    // Gain factor for cascade form
+
+        void Butterworth();
+        void Bilinear(float fc);
+        void ToCascade(Type pb);
+        void GetGain(Type pb);
+        void GetCoefs(Coefs c[], float& gain);
+    };
+}
+#endif  // BILINEAR_BUTTERWORTH_HPP