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
SignalProcessing/Reverbrator.hpp@0:fa74b1130cc3, 2017-01-29 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Sun Jan 29 09:11:30 2017 +0000
- Revision:
- 0:fa74b1130cc3
- Child:
- 5:503bd366fd73
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:fa74b1130cc3 | 1 | //-------------------------------------------------------------- |
MikamiUitOpen | 0:fa74b1130cc3 | 2 | // 残響生成器 |
MikamiUitOpen | 0:fa74b1130cc3 | 3 | // |
MikamiUitOpen | 0:fa74b1130cc3 | 4 | // 2017/01/28, 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 | 0:fa74b1130cc3 | 24 | float yn = cmF1_.Execute(xn) |
MikamiUitOpen | 0:fa74b1130cc3 | 25 | + cmF2_.Execute(xn) |
MikamiUitOpen | 0:fa74b1130cc3 | 26 | + cmF3_.Execute(xn) |
MikamiUitOpen | 0:fa74b1130cc3 | 27 | + cmF4_.Execute(xn); |
MikamiUitOpen | 0:fa74b1130cc3 | 28 | yn = apF2_.Execute(apF1_.Execute(yn)); |
MikamiUitOpen | 0:fa74b1130cc3 | 29 | yn = yn + xn; // add direct input signal |
MikamiUitOpen | 0:fa74b1130cc3 | 30 | return yn; |
MikamiUitOpen | 0:fa74b1130cc3 | 31 | } |
MikamiUitOpen | 0:fa74b1130cc3 | 32 | |
MikamiUitOpen | 0:fa74b1130cc3 | 33 | private: |
MikamiUitOpen | 0:fa74b1130cc3 | 34 | const float G0_; |
MikamiUitOpen | 0:fa74b1130cc3 | 35 | |
MikamiUitOpen | 0:fa74b1130cc3 | 36 | CombFilter cmF1_, cmF2_, cmF3_, cmF4_; |
MikamiUitOpen | 0:fa74b1130cc3 | 37 | AllPassFilter apF1_, apF2_; |
MikamiUitOpen | 0:fa74b1130cc3 | 38 | }; |
MikamiUitOpen | 0:fa74b1130cc3 | 39 | #endif // ECHO_SYSTEM_HPP |