Synthesizer based on the Unzen / Nucleo F746ZG
Dependencies: amakusa mbed-dsp mbed shimabara ukifune unzen_nucleo_f746
Fork of skeleton_unzen_nucleo_f746 by
雲仙フレームワークのテストとして作っているプロジェクトです。中身はどんどん変っていきます。 説明はDSP空挺団の「シンセサイザー」カテゴリーを参照してください。初回は「ドッグフードを食べる」です。
Diff: signal_processing.h
- Revision:
- 14:cec63d8da48c
- Parent:
- 13:b33cb5925113
- Child:
- 15:de22b9d147e0
--- a/signal_processing.h Sun Jan 29 03:05:56 2017 +0000 +++ b/signal_processing.h Mon Jan 30 14:48:42 2017 +0000 @@ -3,6 +3,34 @@ #include "amakusa.h" +enum wave_style { triangle, square }; + + // User Signal processing Class +class VFO { +public: + // essential members. Do not touch + VFO( void ); + void run( + float out_buffer[], // place to write the right output samples + unsigned int block_size // block size [sample] + ); + + // parameter settings + void set_frequency( int freq ); // unit is Hz. + void set_Fs( int Fs ); // unit is Hz. + void set_duty_cycle( float duty ); // 0 ... 0.5 + void set_wave_style( wave_style style ); +private: + + // internal variables.. + int frequency; // VFO frequency [Hz] + int Fs; // sampling Frequency [Hz] + float duty_cycle; // VFO duty cycle. 0 ... 0.5 + wave_style style; // style of the wave form. + int current_phase; // internal variable of VFO. +}; + + // User Signal processing Class class SignalProcessing { public: @@ -18,13 +46,18 @@ // project depenedent members. void set_volume( float vol ); + void set_frequency( int freq ); // unit is Hz. + void set_Fs( int Fs ); // unit is Hz. + void set_duty_cycle( float duty ); // 0 ... 0.5 + void set_wave_style( wave_style style ); private: // essential members. Do not touch. void enter_critical_section(void); void leave_critical_section(void); // project dependent members. - float volume_level; + float volume_level; // 0 ... 1.0 + VFO *vfo; }; #endif