Synthesizer based on the Unzen / Nucleo F746ZG

Dependencies:   amakusa mbed-dsp mbed shimabara ukifune unzen_nucleo_f746

Fork of skeleton_unzen_nucleo_f746 by seiichi horie

雲仙フレームワークのテストとして作っているプロジェクトです。中身はどんどん変っていきます。 説明はDSP空挺団の「シンセサイザー」カテゴリーを参照してください。初回は「ドッグフードを食べる」です。

Committer:
shorie
Date:
Sat Feb 04 15:03:41 2017 +0000
Revision:
20:53021b2c424d
Parent:
18:b9b1116f8768
Child:
22:dc2cbe8db9d9
Added SV Filter

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shorie 18:b9b1116f8768 1 #include "signal_processing.h"
shorie 18:b9b1116f8768 2
shorie 18:b9b1116f8768 3
shorie 18:b9b1116f8768 4 // constructor.
shorie 18:b9b1116f8768 5 Monophonic::Monophonic( unsigned int block_size )
shorie 18:b9b1116f8768 6 {
shorie 18:b9b1116f8768 7 // initializing the subm-odules.
shorie 18:b9b1116f8768 8 this->vfo = new VFO(); // allocate VFO
shorie 20:53021b2c424d 9 this->dc_blocker = new DCBlocker( block_size );
shorie 20:53021b2c424d 10 this->sv_filter = new SVFilter( block_size );
shorie 20:53021b2c424d 11
shorie 20:53021b2c424d 12 work_buf_a = new float32_t[block_size];
shorie 20:53021b2c424d 13 work_buf_b = new float32_t[block_size];
shorie 18:b9b1116f8768 14 } // End of constructor()
shorie 18:b9b1116f8768 15
shorie 18:b9b1116f8768 16 Monophonic::~Monophonic( void )
shorie 18:b9b1116f8768 17 {
shorie 18:b9b1116f8768 18 // initializing the subm-odules.
shorie 18:b9b1116f8768 19 delete this->vfo;
shorie 20:53021b2c424d 20 delete this->dc_blocker;
shorie 20:53021b2c424d 21 delete this->sv_filter;
shorie 20:53021b2c424d 22
shorie 20:53021b2c424d 23 delete[] work_buf_a;
shorie 20:53021b2c424d 24 delete[] work_buf_b;
shorie 18:b9b1116f8768 25 } // End of constructor()
shorie 18:b9b1116f8768 26
shorie 18:b9b1116f8768 27
shorie 18:b9b1116f8768 28
shorie 18:b9b1116f8768 29 // Run all signal processing.
shorie 18:b9b1116f8768 30 void Monophonic::run(
shorie 18:b9b1116f8768 31 float out_buffer[], // place to write the right output samples
shorie 18:b9b1116f8768 32 unsigned int block_size // block size [sample]
shorie 18:b9b1116f8768 33 )
shorie 18:b9b1116f8768 34 {
shorie 18:b9b1116f8768 35 // place the signal processing coce here
shorie 18:b9b1116f8768 36
shorie 18:b9b1116f8768 37 // VFO
shorie 20:53021b2c424d 38 this->vfo->run( work_buf_a );
shorie 20:53021b2c424d 39
shorie 20:53021b2c424d 40 this->dc_blocker->run( work_buf_a, out_buffer );
shorie 18:b9b1116f8768 41
shorie 18:b9b1116f8768 42 } // End of run()
shorie 18:b9b1116f8768 43
shorie 18:b9b1116f8768 44
shorie 18:b9b1116f8768 45 // Sampling Frequency
shorie 18:b9b1116f8768 46 void Monophonic::set_Fs( int Fs )
shorie 18:b9b1116f8768 47 {
shorie 18:b9b1116f8768 48 this->vfo->set_Fs( Fs );
shorie 18:b9b1116f8768 49 }
shorie 18:b9b1116f8768 50
shorie 18:b9b1116f8768 51 // Oscillation Frequency
shorie 18:b9b1116f8768 52 void Monophonic::set_vfo_frequency( int freq )
shorie 18:b9b1116f8768 53 {
shorie 18:b9b1116f8768 54 this->vfo->set_frequency( freq );
shorie 18:b9b1116f8768 55 }
shorie 18:b9b1116f8768 56
shorie 18:b9b1116f8768 57 // Duty Cycle of VFO
shorie 18:b9b1116f8768 58 void Monophonic::set_vfo_duty_cycle( float duty )
shorie 18:b9b1116f8768 59 {
shorie 18:b9b1116f8768 60 this->vfo->set_duty_cycle( duty );
shorie 18:b9b1116f8768 61 }
shorie 18:b9b1116f8768 62
shorie 18:b9b1116f8768 63 // VFO wave form
shorie 18:b9b1116f8768 64 void Monophonic::set_vfo_wave_form( wave_form form )
shorie 18:b9b1116f8768 65 {
shorie 18:b9b1116f8768 66 this->vfo->set_wave_form( form );
shorie 18:b9b1116f8768 67 }