IISEC / Mbed 2 deprecated echo_machine

Dependencies:   mbed

Revision:
2:718d996170c2
Parent:
1:5972dbd390c8
Child:
3:8ed0851755d7
diff -r 5972dbd390c8 -r 718d996170c2 voiceecho.cpp
--- a/voiceecho.cpp	Wed Apr 17 04:53:40 2019 +0000
+++ b/voiceecho.cpp	Fri Apr 19 04:11:04 2019 +0000
@@ -1,3 +1,10 @@
+/* voiceecho.cpp */
+// voice input to ADC is delayed for 0.1 to 0.5 sec and output to DAC and PWM
+// Copyright Toshihiro Matsui, IISEC, April 2019
+// Any use/copy/modify of this program is fully granted to anyone by the author.
+//
+
+
 #include "mbed.h"
 
 DigitalOut led1(LED1);
@@ -79,7 +86,7 @@
 
 void voice_io()    /*timer driven*/
 {   unsigned short val;
-    wave[readindex]= mic.read_u16();  //mic.read()*30000;
+    wave[readindex]= wave[readindex]*0.4+mic.read_u16()*0.6;  //mic.read()*30000;
     val=wave[writeindex];
     pwm.write((float)val/65536.0);
     spk.write_u16(val); // (val/30000.0  );