![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Vowel synthesizer using digital resonators. This program can run without LCD display. ディジタル共振器を使った合成母音ジェネレータ.LCD表示器なしでも動く.
Dependencies: UITDSP_ADDA UIT_ACM1602NI UIT_AQM1602 mbed
Resonator.hpp@0:6c67a9387981, 2014-12-02 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Tue Dec 02 00:06:08 2014 +0000
- Revision:
- 0:6c67a9387981
- Child:
- 4:dd2ec72068d0
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:6c67a9387981 | 1 | //------------------------------------------------------------------------------ |
MikamiUitOpen | 0:6c67a9387981 | 2 | // 音声合成で使う共振器(ヘッダ) |
MikamiUitOpen | 0:6c67a9387981 | 3 | // 作成者:三上直樹,2013/11/27 作成,(c)三上直樹 2013 |
MikamiUitOpen | 0:6c67a9387981 | 4 | //------------------------------------------------------------------------------ |
MikamiUitOpen | 0:6c67a9387981 | 5 | |
MikamiUitOpen | 0:6c67a9387981 | 6 | #include "mbed.h" |
MikamiUitOpen | 0:6c67a9387981 | 7 | |
MikamiUitOpen | 0:6c67a9387981 | 8 | #ifndef RESONATOR_HPP |
MikamiUitOpen | 0:6c67a9387981 | 9 | #define RESONATOR_HPP |
MikamiUitOpen | 0:6c67a9387981 | 10 | |
MikamiUitOpen | 0:6c67a9387981 | 11 | namespace Mikami |
MikamiUitOpen | 0:6c67a9387981 | 12 | { |
MikamiUitOpen | 0:6c67a9387981 | 13 | class Resonator |
MikamiUitOpen | 0:6c67a9387981 | 14 | { |
MikamiUitOpen | 0:6c67a9387981 | 15 | private: |
MikamiUitOpen | 0:6c67a9387981 | 16 | static float piT_; |
MikamiUitOpen | 0:6c67a9387981 | 17 | float a1_, a2_, b0_; |
MikamiUitOpen | 0:6c67a9387981 | 18 | float yn1_, yn2_; |
MikamiUitOpen | 0:6c67a9387981 | 19 | |
MikamiUitOpen | 0:6c67a9387981 | 20 | // コンストラクタに共通な初期化 |
MikamiUitOpen | 0:6c67a9387981 | 21 | void Initialize(float fr, float bw, float fs); |
MikamiUitOpen | 0:6c67a9387981 | 22 | |
MikamiUitOpen | 0:6c67a9387981 | 23 | public: |
MikamiUitOpen | 0:6c67a9387981 | 24 | // 共振周波数と帯域幅に対応する構造体 |
MikamiUitOpen | 0:6c67a9387981 | 25 | struct FrBw { float fr, bw; }; |
MikamiUitOpen | 0:6c67a9387981 | 26 | |
MikamiUitOpen | 0:6c67a9387981 | 27 | // デフォルト・コンストラクタ |
MikamiUitOpen | 0:6c67a9387981 | 28 | Resonator() {} |
MikamiUitOpen | 0:6c67a9387981 | 29 | |
MikamiUitOpen | 0:6c67a9387981 | 30 | // 初期化を行うコンストラクタ |
MikamiUitOpen | 0:6c67a9387981 | 31 | Resonator(float fr, float bw, float fs) { Initialize(fr, bw, fs); } |
MikamiUitOpen | 0:6c67a9387981 | 32 | |
MikamiUitOpen | 0:6c67a9387981 | 33 | // 初期化を行うコンストラクタ(構造体使用) |
MikamiUitOpen | 0:6c67a9387981 | 34 | Resonator(FrBw fb, float fs) { Initialize(fb.fr, fb.bw, fs); } |
MikamiUitOpen | 0:6c67a9387981 | 35 | |
MikamiUitOpen | 0:6c67a9387981 | 36 | // 共振器のパラメータの設定 |
MikamiUitOpen | 0:6c67a9387981 | 37 | void Set(float fr, float bw); |
MikamiUitOpen | 0:6c67a9387981 | 38 | |
MikamiUitOpen | 0:6c67a9387981 | 39 | // 共振器のパラメータの設定(構造体使用) |
MikamiUitOpen | 0:6c67a9387981 | 40 | void Set(FrBw fb) { Set(fb.fr, fb.bw); } |
MikamiUitOpen | 0:6c67a9387981 | 41 | |
MikamiUitOpen | 0:6c67a9387981 | 42 | // 内部の遅延器をクリア |
MikamiUitOpen | 0:6c67a9387981 | 43 | void Clear() { yn1_ = 0; yn2_ = 0; } |
MikamiUitOpen | 0:6c67a9387981 | 44 | |
MikamiUitOpen | 0:6c67a9387981 | 45 | // 共振器に対応する処理の実行 |
MikamiUitOpen | 0:6c67a9387981 | 46 | float Execute(float xin); |
MikamiUitOpen | 0:6c67a9387981 | 47 | }; |
MikamiUitOpen | 0:6c67a9387981 | 48 | } |
MikamiUitOpen | 0:6c67a9387981 | 49 | #endif // RESONATOR_HPP |
MikamiUitOpen | 0:6c67a9387981 | 50 |