Experimental implementation of the adaptive filter of "Interface" magazine in 2016-2017
Dependencies: amakusa mbed-dsp mbed shimabara ukifune unzen_nucleo_f746
Fork of skeleton_unzen_nucleo_f746 by
ハードウェアおよびソフトウェアはskelton_unzen_nucleo_f746を基本にしています。
Diff: signal_processing.h
- Revision:
- 20:699e209fd19a
- Parent:
- 19:f5e785fe50b1
--- a/signal_processing.h Fri Feb 03 14:35:46 2017 +0000 +++ b/signal_processing.h Fri Feb 03 14:41:40 2017 +0000 @@ -3,70 +3,6 @@ #include "amakusa.h" -#define SAMPLING_FREQUENCY 48000 - -enum wave_form { triangle, square }; - - // Variable Frequency Oscillator. Only square and triangle -class VFO { -public: - VFO( void ); - virtual ~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_form( wave_form form ); -private: - - // control variables. - int frequency; // VFO frequency [Hz] - int Fs; // sampling Frequency [Hz] - float duty_cycle; // VFO duty cycle. 0 ... 0.5 - wave_form form; // form of the wave form. - - // internal variable. - int current_phase; // internal variable of VFO. - int half_way; // change point by duty cycle. ( period * duty_cycle ). - float rising_rate; - float falling_rate; - - void update_parameters(void); // call one of the parameter is changed. -}; - - // Blocking DC -class DCBlocker : public amakusa::AbstractFilter { -public: - DCBlocker( uint32_t blockSize ); - virtual void run( float32_t *pSrc, float32_t *pDst, uint32_t blockSize = 0 ); -private: - float x_last; - float y_last; -}; - - // Monophonic synthsizer class -class Monophonic { -public: - Monophonic( unsigned int block_size ); - virtual ~Monophonic(void); - void run( - float out_buffer[], // place to write the right output samples - unsigned int block_size // block size [sample] - ); - void set_Fs( int Fs ); // unit is Hz. - void set_vfo_frequency( int freq ); // unit is Hz. - void set_vfo_duty_cycle( float duty ); // 0 ... 0.5 - void set_vfo_wave_form( wave_form form ); -private: - VFO *vfo; -}; - - // User Signal processing Class class SignalProcessing { public: @@ -82,18 +18,13 @@ // project depenedent members. void set_volume( float vol ); - void set_Fs( int Fs ); // unit is Hz. - void set_vfo_frequency( int freq ); // unit is Hz. - void set_vfo_duty_cycle( float duty ); // 0 ... 0.5 - void set_vfo_wave_form( wave_form form ); private: // essential members. Do not touch. void enter_critical_section(void); void leave_critical_section(void); // project dependent members. - float volume_level; // 0 ... 1.0 - Monophonic * note; + float volume_level; }; #endif