Arkadi Rafalovich
/
ADC_DAC
Microphone Record and play. using Nucleo STM32F303RE STM32 Hands On Makers Workshop
Diff: main.cpp
- Revision:
- 1:5f34e59f97f7
- Parent:
- 0:ff0b6f6ddb23
--- a/main.cpp Wed Nov 11 19:16:20 2015 +0000 +++ b/main.cpp Thu Nov 26 22:47:40 2015 +0000 @@ -12,7 +12,7 @@ Ticker Audio_Sample_Ticker; // Audio Buffer -#define BUFFERSIZE 30000 // Sample rate 10 Khz, 3 sec record 30*10^3 samples +#define BUFFERSIZE 30000 // Sample rate 5 Khz, 3 sec record 30*10^3 samples uint16_t ABuffer[BUFFERSIZE]={0}; // variables to store buffer position and lenght uint32_t BufferEnd=0; @@ -60,7 +60,7 @@ CurY=AHPF*(LastY+CurU-LastU); // Amplify, add dc offset and add to buffer; - AudioSignal=CurY*3.0f+0.5f;//*10.0f+0.5f); + AudioSignal=CurY*2.0f+0.5f;//*10.0f+0.5f); if (AudioSignal>1){ AudioSignal=1; }else if (AudioSignal<0){ @@ -94,7 +94,7 @@ }else if (ButtonState) { //Button is unpressed if (!LastButtonState){ // first sample // Re-set Ticker object - Audio_Sample_Ticker.attach_us(&Audio_Sample, 75); // create 10Khz Ticker + Audio_Sample_Ticker.attach_us(&Audio_Sample, 50); // create 10Khz Ticker // Buffer_i=0; } myled.write(0); // LED Off