What I'm doing wrong (Multiply & AnalyzePeak)


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.

#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() {
  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);

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());}
  delay (1);
You've set the dc1 amplitude to zero, so printing the dc1 peak will be zero and multiplying zero by anything will give you zero out from the multiplication too. At least, that's what I get when I run your code.
Try setting dc1 amplitude to 0.5 and then it will print:
in=0.50 out=0.25

Also … AudioAnalyzePeak is yet another example of an object which behaves incorrectly when fed NULL block pointers. The documentation clearly says to treat these as silent audio, so it should return true from a call toavailable() if an update has occurred, and 0.0 as the amplitude. But it doesn’t, it just tells you there’s no new peak value available.
Thanks all!

The strange thing is that today I re-run my test code and I did get a streem of "0" as the output, but for some stangre reason yestorday I got nothing out... maybe the laptop lost connection with the serial monitor...

Now I will try to find what's wrong with my larger code.