STM32F446 内蔵の DAC から出力する際に,補間フィルタを利用し,標本化周波数を入力の際の4倍の標本化周波数で出力するためのライブラリ.このライブラリを登録した際のプログラム: Demo_DSP_ADDA_Multirate. Library for outputting from built-in DAC in STM32F446 using interpolation filter at sampling frequency of 4 times in case of input.
Dependencies: Array_Matrix DSP_ADDA
Dependents: Demo_DSP_ADDA_Multirate DSP_AD_DA_Multirate DSP_GraphicEqualizerB DSP_VariableLHpfB ... more
Revision 12:f7bfe38c93ab, committed 2021-12-22
- Comitter:
- MikamiUitOpen
- Date:
- Wed Dec 22 08:01:24 2021 +0000
- Parent:
- 11:91190380ca3c
- Commit message:
- 13
Changed in this revision
diff -r 91190380ca3c -r f7bfe38c93ab MultirateLiPh.cpp --- a/MultirateLiPh.cpp Sun Dec 20 08:10:40 2020 +0000 +++ b/MultirateLiPh.cpp Wed Dec 22 08:01:24 2021 +0000 @@ -2,10 +2,11 @@ // 出力を 4 倍にアップサンプリングするクラス // 補間処理で使うフィルタ:直線位相 FIR フィルタ // -// 2020/12/20, Copyright (c) 2020 MIKAMI, Naoki +// 2021/12/22, Copyright (c) 2021 MIKAMI, Naoki //----------------------------------------------------------- #include "MultirateLiPh.hpp" +#include "MultirateLiPhCoefs.hpp" // デフォルトの補間用フィルタの係数 namespace Mikami {
diff -r 91190380ca3c -r f7bfe38c93ab MultirateLiPh.hpp --- a/MultirateLiPh.hpp Sun Dec 20 08:10:40 2020 +0000 +++ b/MultirateLiPh.hpp Wed Dec 22 08:01:24 2021 +0000 @@ -4,7 +4,7 @@ // // 出力端子: A2 (PA_4) // -// 2020/12/20, Copyright (c) 2020 MIKAMI, Naoki +// 2021/12/22, Copyright (c) 2021 MIKAMI, Naoki //----------------------------------------------------------- #include "DSP_AdcIntr.hpp"
diff -r 91190380ca3c -r f7bfe38c93ab MultirateLiPhCoefs.cpp --- a/MultirateLiPhCoefs.cpp Sun Dec 20 08:10:40 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -//------------------------------------------------------------------- -// デフォルトの補間用フィルタの係数 -// この係数は,入力の標本化周波数を 10 kHz, -// 出力の標本化周波数を 40 kHz として設計した -// -// 2020/12/06, Copyright (c) 2020 MIKAMI, Naoki -//------------------------------------------------------------------- - -#include "MultirateLiPh.hpp" - -namespace Mikami -{ - // 使用窓関数 Kaiser 窓 - // 標本化周波数 (kHz) 40.000000 - // 次数 70 - // 種類 LPF - // 遮断周波数 (kHz) 5.000000 - // 減衰量 (dB) 40.00 - const int MultirateLiPh::ORDER_ = 70; - const float MultirateLiPh::HK1_[] = { - 3.806160E-03f, -7.410556E-03f, 1.260559E-02f, -1.994242E-02f, - 3.036776E-02f, -4.579744E-02f, 7.095016E-02f, -1.214690E-01f, - 2.969901E-01f, 8.992744E-01f, -1.749060E-01f, 9.096828E-02f, - -5.663444E-02f, 3.726704E-02f, -2.468324E-02f, 1.596038E-02f, - -9.780624E-03f, 5.435560E-03f}; - const float MultirateLiPh::HK2_[] = { - 6.477720E-03f, -1.208128E-02f, 2.009782E-02f, -3.140681E-02f, - 4.757964E-02f, -7.194132E-02f, 1.131902E-01f, -2.034948E-01f, - 6.336764E-01f, 6.336764E-01f, -2.034948E-01f, 1.131902E-01f, - -7.194132E-02f, 4.757964E-02f, -3.140681E-02f, 2.009782E-02f, - -1.208128E-02f, 6.477720E-03f}; - const float MultirateLiPh::HK3_[] = { - 5.435560E-03f, -9.780624E-03f, 1.596038E-02f, -2.468324E-02f, - 3.726704E-02f, -5.663444E-02f, 9.096828E-02f, -1.749060E-01f, - 8.992744E-01f, 2.969901E-01f, -1.214690E-01f, 7.095016E-02f, - -4.579744E-02f, 3.036776E-02f, -1.994242E-02f, 1.260559E-02f, - -7.410556E-03f, 3.806160E-03f}; -} \ No newline at end of file
diff -r 91190380ca3c -r f7bfe38c93ab MultirateLiPhCoefs.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MultirateLiPhCoefs.hpp Wed Dec 22 08:01:24 2021 +0000 @@ -0,0 +1,38 @@ +//------------------------------------------------------------------- +// デフォルトの補間用フィルタの係数 +// この係数は,入力の標本化周波数を 10 kHz, +// 出力の標本化周波数を 40 kHz として設計した +// +// 2021/12/22, Copyright (c) 2021 MIKAMI, Naoki +//------------------------------------------------------------------- + +#include "MultirateLiPh.hpp" + +namespace Mikami +{ + // 使用窓関数 Kaiser 窓 + // 標本化周波数 (kHz) 40.000000 + // 次数 72 + // 種類 LPF + // 遮断周波数 (kHz) 5.000000 + // 減衰量 (dB) 40.00 + const int MultirateLiPh::ORDER_ = 72; + const float MultirateLiPh::HK1_[] = { + 4.431256E-03f, -8.146596E-03f, 1.341366E-02f, -2.077330E-02f, + 3.116614E-02f, -4.650688E-02f, 7.151836E-02f, -1.218529E-01f, + 2.971602E-01f, 8.993316E-01f, -1.751857E-01f, 9.144896E-02f, + -5.727932E-02f, 3.802786E-02f, -2.550498E-02f, 1.678651E-02f, + -1.055827E-02f, 6.120216E-03f}; + const float MultirateLiPh::HK2_[] = { + 7.405152E-03f, -1.315348E-02f, 2.125564E-02f, -3.257789E-02f, + 4.868468E-02f, -7.290120E-02f, 1.139337E-01f, -2.039652E-01f, + 6.338376E-01f, 6.338376E-01f, -2.039652E-01f, 1.139337E-01f, + -7.290120E-02f, 4.868468E-02f, -3.257789E-02f, 2.125564E-02f, + -1.315348E-02f, 7.405152E-03f}; + const float MultirateLiPh::HK3_[] = { + 6.120216E-03f, -1.055827E-02f, 1.678651E-02f, -2.550498E-02f, + 3.802786E-02f, -5.727932E-02f, 9.144896E-02f, -1.751857E-01f, + 8.993316E-01f, 2.971602E-01f, -1.218529E-01f, 7.151836E-02f, + -4.650688E-02f, 3.116614E-02f, -2.077330E-02f, 1.341366E-02f, + -8.146596E-03f, 4.431256E-03f}; +} \ No newline at end of file