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空挺団の「シンセサイザー」カテゴリーを参照してください。初回は「ドッグフードを食べる」です。

Revision:
26:e99f71165e19
Parent:
22:dc2cbe8db9d9
Child:
27:fcb1f1da2ad7
diff -r d15dd7b9101c -r e99f71165e19 monophonic.cpp
--- a/monophonic.cpp	Fri Feb 10 13:28:41 2017 +0000
+++ b/monophonic.cpp	Fri Feb 10 21:31:17 2017 +0000
@@ -5,12 +5,15 @@
 Monophonic::Monophonic( unsigned int  block_size )
 {
         // initializing the subm-odules.
-    this->vfo = new VFO();      // allocate VFO
+    this->vfo = new VFO(block_size);      // allocate VFO
     this->dc_blocker = new DCBlocker( block_size );
     this->sv_filter = new SVFilter( block_size );
+//    this->eg = new EG( block_size );
     
     work_buf_a = new float32_t[block_size];
     work_buf_b = new float32_t[block_size];
+    
+    this->block_size = block_size;
 }   // End of constructor()
 
 Monophonic::~Monophonic( void )
@@ -19,6 +22,7 @@
     delete this->vfo;
     delete this->dc_blocker;
     delete this->sv_filter;
+//    delete this->eg;
     
     delete[] work_buf_a;
     delete[] work_buf_b;
@@ -28,12 +32,11 @@
     
         // Run all signal processing.
 void Monophonic::run(           
-        float out_buffer[],    // place to write the right output samples
-        unsigned int block_size     // block size [sample]
+        float out_buffer[]    // place to write the right output samples
         )
 {
         // place the signal processing coce here
-    this->vfo->run( work_buf_a, block_size );
+    this->vfo->run( work_buf_a );
     
         // blocking DC.
     this->dc_blocker->run( work_buf_a, work_buf_b );
@@ -41,6 +44,13 @@
         // applying filter.
     this->sv_filter->run( work_buf_b, out_buffer );
     
+        // generate envelope
+//    this->eg->run( work_buf_a );
+    
+        // apply envelope
+//    for ( int i= 0; i< this->block_size; i++ )
+//        out_buffer[ i ] *= work_buf_a[ i ];
+        
 }   // End of run()
     
 
@@ -82,8 +92,40 @@
     this->sv_filter->set_Q( Q );
 }
 
-        // Set the f_factor value. 
+    // Set the f_factor value. 
 void Monophonic::set_filter_f_factor( float f_factor )
 {
     this->sv_filter->set_f_factor( f_factor );
 }
+
+    // Turn note on 
+void Monophonic::eg_on(void)
+{
+//    this->eg->on();
+}
+
+    // Turn note off
+void Monophonic::eg_off(void)
+{
+//    this->eg->off();
+}
+
+void Monophonic::set_eg_attack( float32_t attack )
+{
+//    this->eg->set_attack( attack );
+}
+void Monophonic::set_eg_decay( float32_t decay )
+{
+//    this->eg->set_decay( decay );
+}
+
+void Monophonic::set_eg_sustain( float32_t sustain )
+{
+//    this->eg->set_sustain( sustain );
+}
+
+void Monophonic::set_eg_release ( float32_t release )
+{
+//    this->eg->set_release( release );
+}
+