#include <Plaquette.h>
//DEL vars
AnalogOut delRose(9);
AnalogOut delVert(10);
AnalogOut delBleu(11);
//sadWave vars
SineWave sadWave(3.0); //onde sinusoidale avec un period de 2 secondes
SineWave sadWave2(7.0);
float supersadWave; // variable pour stocker l'addition des deux sadWaves plus tard
//happyWave vars
SquareWave happyWave(3.0); // onde carre avec period 500 millisecondes
TriangleWave happySaw(2.0);
float happyNoise;
//nervousWave vars
SquareWave nervousWave(10.0);
Ramp nervousRamp(7.0);
Alarm nervousAlarm(3.0);
void begin() {
happySaw.width(0); // convert the triangle wave into a sawtooth by adjusting the width
//reduce amplitude of sad waves because we will add them
sadWave.amplitude(0.7);
sadWave2.amplitude(0.5);
//define the nervous ramp parameters
nervousRamp.easing(easeInQuint);
nervousRamp.fromTo(1.0, 0.1);
nervousRamp.start();
}
void step() {
///////signal addition for SuperSadWave ///////////////////
supersadWave = (sadWave + sadWave2) / 2; // Combine waves mathematically
//adding noise into signal for Happy Wave//////////////////
happyNoise = random(1, 10); //random numbers min, max
happyWave.frequency(happyNoise);
happyWave.amplitude(happySaw);
/////using ramps and timers for nervous Wave////////////
nervousWave.period(nervousRamp);
// If chrono reached 10 seconds.
if (nervousRamp.finished()) {
nervousAlarm.start();
}
if (nervousAlarm.finished()) {
nervousRamp.start();
}
//////////////envoi les signalx au DELs//////////////////
happyWave >> delRose;
supersadWave >> delBleu;
nervousWave >> delVert;
print(nervousRamp);
print(" "); // Print white space
println(nervousAlarm);
// ///////////print to serial monitor/////////////////
// print(happyWave); // Print wave value
// print(" "); // Print white space
// print(nervousWave); // Print wave value
// print(" "); // Print white space
// println(supersadWave);
}