Synthesizer for Japanese five vowels with keyboard. 鍵盤と一緒になった日本語の5母音の合成器.
Dependencies: BSP_DISCO_F746NG_patch_fixed BUTTON_GROUP LCD_DISCO_F746NG TS_DISCO_F746NG mbed
MyClasses_Functions/Rosenberg.hpp@0:a98746e7a170, 2016-02-24 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Wed Feb 24 13:00:12 2016 +0000
- Revision:
- 0:a98746e7a170
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:a98746e7a170 | 1 | //------------------------------------------------------------------------------ |
MikamiUitOpen | 0:a98746e7a170 | 2 | // 声帯波の合成 ― Rosenberg 波(ヘッダ) |
MikamiUitOpen | 0:a98746e7a170 | 3 | // 作成者:三上直樹,2013/10/27 作成,(c)三上直樹 2013 |
MikamiUitOpen | 0:a98746e7a170 | 4 | //------------------------------------------------------------------------------ |
MikamiUitOpen | 0:a98746e7a170 | 5 | |
MikamiUitOpen | 0:a98746e7a170 | 6 | #ifndef ROSENBERG_HPP |
MikamiUitOpen | 0:a98746e7a170 | 7 | #define ROSENBERGL_HPP |
MikamiUitOpen | 0:a98746e7a170 | 8 | |
MikamiUitOpen | 0:a98746e7a170 | 9 | class Rosenberg |
MikamiUitOpen | 0:a98746e7a170 | 10 | { |
MikamiUitOpen | 0:a98746e7a170 | 11 | private: |
MikamiUitOpen | 0:a98746e7a170 | 12 | const float dt_; |
MikamiUitOpen | 0:a98746e7a170 | 13 | |
MikamiUitOpen | 0:a98746e7a170 | 14 | float period_, t1_, t2_, t_, amp_; |
MikamiUitOpen | 0:a98746e7a170 | 15 | |
MikamiUitOpen | 0:a98746e7a170 | 16 | // コピー・コンストラクタの使用禁止 |
MikamiUitOpen | 0:a98746e7a170 | 17 | Rosenberg(const Rosenberg& g); |
MikamiUitOpen | 0:a98746e7a170 | 18 | // 代入演算子の使用禁止 |
MikamiUitOpen | 0:a98746e7a170 | 19 | Rosenberg& operator=(const Rosenberg& g); |
MikamiUitOpen | 0:a98746e7a170 | 20 | |
MikamiUitOpen | 0:a98746e7a170 | 21 | public: |
MikamiUitOpen | 0:a98746e7a170 | 22 | // 初期化を行うコンストラクタ |
MikamiUitOpen | 0:a98746e7a170 | 23 | // f0: 基本周波数 |
MikamiUitOpen | 0:a98746e7a170 | 24 | // fs: 標本化周波数 |
MikamiUitOpen | 0:a98746e7a170 | 25 | // amp: 振幅 |
MikamiUitOpen | 0:a98746e7a170 | 26 | Rosenberg(float f0, float fs, float amp) |
MikamiUitOpen | 0:a98746e7a170 | 27 | : dt_(1.0f/fs), t_(0), amp_(amp) |
MikamiUitOpen | 0:a98746e7a170 | 28 | { SetPeriod(f0); } |
MikamiUitOpen | 0:a98746e7a170 | 29 | |
MikamiUitOpen | 0:a98746e7a170 | 30 | // 基本周期の再設定 |
MikamiUitOpen | 0:a98746e7a170 | 31 | // f0: 基本周波数 |
MikamiUitOpen | 0:a98746e7a170 | 32 | void SetPeriod(float f0); |
MikamiUitOpen | 0:a98746e7a170 | 33 | |
MikamiUitOpen | 0:a98746e7a170 | 34 | // 振幅の再設定 |
MikamiUitOpen | 0:a98746e7a170 | 35 | void SetAmplitude(float amp) { amp_ = amp; } |
MikamiUitOpen | 0:a98746e7a170 | 36 | |
MikamiUitOpen | 0:a98746e7a170 | 37 | // t_ = 0 に設定 |
MikamiUitOpen | 0:a98746e7a170 | 38 | void Reset() { t_ = 0; } |
MikamiUitOpen | 0:a98746e7a170 | 39 | |
MikamiUitOpen | 0:a98746e7a170 | 40 | // Rosengerg 波の計算 |
MikamiUitOpen | 0:a98746e7a170 | 41 | float Execute(); |
MikamiUitOpen | 0:a98746e7a170 | 42 | }; |
MikamiUitOpen | 0:a98746e7a170 | 43 | |
MikamiUitOpen | 0:a98746e7a170 | 44 | #endif // ROSENBERG_HPP |