Demo program of digital signal processing: Variable LPF/HPF, Vocal canceller, Pitch shifter, Reverbrator. ディジタル信号処理のデモプログラム. 遮断周波数可変 LPF/HPF,ボーカルキャンセラ,ピッチシフタ,残響生成器.

Dependencies:   Array_Matrix F446_AD_DA UIT_AQM1602 mbed

Committer:
MikamiUitOpen
Date:
Tue Jan 31 12:52:35 2017 +0000
Revision:
5:503bd366fd73
Parent:
0:fa74b1130cc3
6

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikamiUitOpen 0:fa74b1130cc3 1 //--------------------------------------------------------------
MikamiUitOpen 0:fa74b1130cc3 2 // 残響生成器
MikamiUitOpen 0:fa74b1130cc3 3 //
MikamiUitOpen 5:503bd366fd73 4 // 2017/01/31, Copyright (c) 2017 MIKAMI, Naoki
MikamiUitOpen 0:fa74b1130cc3 5 //--------------------------------------------------------------
MikamiUitOpen 0:fa74b1130cc3 6
MikamiUitOpen 0:fa74b1130cc3 7 #ifndef ECHO_SYSTEM_HPP
MikamiUitOpen 0:fa74b1130cc3 8 #define ECHO_SYSTEM_HPP
MikamiUitOpen 0:fa74b1130cc3 9
MikamiUitOpen 0:fa74b1130cc3 10 #include "ReverbUnit.hpp"
MikamiUitOpen 0:fa74b1130cc3 11
MikamiUitOpen 0:fa74b1130cc3 12 class EchoSystem : public SignalProcessing
MikamiUitOpen 0:fa74b1130cc3 13 {
MikamiUitOpen 0:fa74b1130cc3 14 public:
MikamiUitOpen 0:fa74b1130cc3 15 EchoSystem(float gC = 0.8f, float gA = 0.6f)
MikamiUitOpen 0:fa74b1130cc3 16 : G0_(1.0f - gC),
MikamiUitOpen 0:fa74b1130cc3 17 cmF1_(gC, 1759), cmF2_(gC, 1543),
MikamiUitOpen 0:fa74b1130cc3 18 cmF3_(gC, 1319), cmF4_(gC, 1301),
MikamiUitOpen 0:fa74b1130cc3 19 apF1_(gA, 241), apF2_(gA, 173) {}
MikamiUitOpen 0:fa74b1130cc3 20
MikamiUitOpen 0:fa74b1130cc3 21 virtual float Execute(float xn1, float xn2)
MikamiUitOpen 0:fa74b1130cc3 22 {
MikamiUitOpen 0:fa74b1130cc3 23 float xn = G0_*(xn1 + xn2)*0.5f;
MikamiUitOpen 5:503bd366fd73 24 float yn = cmF1_.Execute(xn) + cmF2_.Execute(xn)
MikamiUitOpen 5:503bd366fd73 25 + cmF3_.Execute(xn) + cmF4_.Execute(xn);
MikamiUitOpen 0:fa74b1130cc3 26 yn = apF2_.Execute(apF1_.Execute(yn));
MikamiUitOpen 0:fa74b1130cc3 27 yn = yn + xn; // add direct input signal
MikamiUitOpen 0:fa74b1130cc3 28 return yn;
MikamiUitOpen 0:fa74b1130cc3 29 }
MikamiUitOpen 0:fa74b1130cc3 30
MikamiUitOpen 0:fa74b1130cc3 31 private:
MikamiUitOpen 0:fa74b1130cc3 32 const float G0_;
MikamiUitOpen 0:fa74b1130cc3 33
MikamiUitOpen 0:fa74b1130cc3 34 CombFilter cmF1_, cmF2_, cmF3_, cmF4_;
MikamiUitOpen 0:fa74b1130cc3 35 AllPassFilter apF1_, apF2_;
MikamiUitOpen 0:fa74b1130cc3 36 };
MikamiUitOpen 0:fa74b1130cc3 37 #endif // ECHO_SYSTEM_HPP