KIK01 Release

Dependencies:   mcp3008 mbed mbed-rtos AverageMCP3008 VoltageMonitor

Revision:
9:d1e6eae9722b
Parent:
8:bb34a4894337
Child:
10:79134dbb339d
--- a/main.cpp	Sun Jun 04 10:49:07 2017 +0000
+++ b/main.cpp	Sun Jun 04 11:39:50 2017 +0000
@@ -13,14 +13,9 @@
 #define TITLE_STR2      ("20170604")
 
 #define PI_F            (3.1415926f)
-#define SAMPLING_RATE   (48000)
+#define SAMPLING_RATE   (96000)
 #define SAMPLING_PERIOD (1.0f/SAMPLING_RATE)
 
-//#define FREQUENCY_ATTACK    (5)
-//#define FREQUENCY_RELEASE   (300)
-//#define AMPLITUDE_ATTACK    (50)
-//#define AMPLITUDE_RELEASE   (200)
-
 AnalogOut Dac1(PA_5);
 
 AnalogIn Ain0(PA_0);
@@ -126,8 +121,7 @@
     float releaseTauRatio;
 };
     
-EnvelopeAR envelopeFrequency(
-    5, 300, 880.0f, 120.0f, 40.0f, 0.36f, 0.1f);
+EnvelopeAR envelopeFrequency(5, 300, 880.0f, 120.0f, 40.0f, 0.36f, 0.1f);
 EnvelopeAR envelopeAmplitude(50, 200, 0.99f, 1.0f, 0.0f);
 
 volatile EnvelopeParam frequencyParam;
@@ -209,15 +203,15 @@
     amplitudeParam.v1 = 1.0f;
     amplitudeParam.v2 = 0.0f;
     amplitudeParam.attackTauRatio = 0.36f;
-    amplitudeParam.releaseTauRatio = Ain4.read();
+    amplitudeParam.releaseTauRatio = Ain4.read() + 0.01f;
     
-    frequencyParam.attack = 5;
+    frequencyParam.attack = Ain8.read() * envelopeLength * 0.1f;
     frequencyParam.release = 300;
     frequencyParam.v0 = Ain5.read() * 4000.0f;
     frequencyParam.v1 = Ain6.read() * 400.0f;
     frequencyParam.v2 = Ain7.read() * 400.0f;
-    frequencyParam.attackTauRatio = 0.36f;
-    frequencyParam.releaseTauRatio = 0.1f;    
+    frequencyParam.attackTauRatio = Ain9.read() + 0.01f;
+    frequencyParam.releaseTauRatio = Ain10.read() + 0.01f;    
 }
 
 int main()
@@ -249,6 +243,6 @@
         printf("%.2f\t%.2f\t%.2f\t", frequencyParam.v0, frequencyParam.v1, frequencyParam.v2);
         printf("%.2f\t%.2f\r\n", frequencyParam.attackTauRatio, frequencyParam.releaseTauRatio);
         
-        Thread::wait(500);    
+        Thread::wait(100);    
     }
 }