I'm having a code in which multiply is not working. So I made a supper simple example and tested it, but this one is also not working as I expect it.
I run this code and get no output.
Why does the two peak detect does not show any input?
If I remove the "if (peak_in.available())" I get a constat "1" in/out reading.
I have no idea what I'm doing wrong in the code.
I run this code and get no output.
Why does the two peak detect does not show any input?
If I remove the "if (peak_in.available())" I get a constat "1" in/out reading.
I have no idea what I'm doing wrong in the code.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthWaveformSine sine1; //xy=169.1999969482422,360
AudioSynthWaveformSine sine2; //xy=178.1999969482422,422
AudioSynthWaveformDc dc2; //xy=304.20001220703125,417
AudioSynthWaveformDc dc1; //xy=305.20001220703125,359.00001525878906
AudioEffectMultiply multiply1; //xy=497.20001220703125,362
AudioAnalyzePeak peak_in; //xy=506.20001220703125,265
AudioAnalyzePeak peak_out; //xy=677.2000122070312,313
AudioOutputI2S i2s2; //xy=680.2000122070312,381
AudioConnection patchCord1(dc2, 0, multiply1, 1);
AudioConnection patchCord2(dc1, 0, multiply1, 0);
AudioConnection patchCord3(dc1,0, peak_in,0);
AudioConnection patchCord4(multiply1, peak_out);
AudioConnection patchCord5(multiply1, 0, i2s2, 1);
AudioControlSGTL5000 audioShield; //xy=478.20001220703125,555
// GUItool: end automatically generated code
elapsedMillis update; //counter for last touch screen press
void setup() {
Serial.begin(57600);
AudioMemory(6);
audioShield.enable(); // start audio board
audioShield.volume(0.5); // output level
// sine1.amplitude(1.0);
// sine1.frequency(600);
// sine2.amplitude(0.01);
// sine2.frequency(0.1);
dc1.amplitude(0.0);
dc2.amplitude(.5);
}
void loop() {
if (update > 5) {
if (peak_in.available()) {Serial.print ("in="); Serial.print(peak_in.read());}
if (peak_out.available()) {Serial.print (" out="); Serial.println(peak_out.read());}
update=0;
}
delay (1);
}