delayMicroseconds(analogRead(A2)*i);// lower the pitch over time
analogWrite(11,255);
delayMicroseconds(analogRead(A2)*i);// lower the pitch over time
analogWrite(11,0);
// delay(1);
}
//delay(1);
//SUSTAIN RELEASE
for(inti=0;i<55;i++){// i = DELAY+SUSTAIN+RELEASE
analogWrite(11,0);
delayMicroseconds(analogRead(A1)*i);// lower the pitch over time
analogWrite(11,255);
delayMicroseconds(analogRead(A1)*i);// lower the pitch over time
analogWrite(11,0);
delay(1);
}
triggered=true;
}
elseif(!input3&&triggered){//if there is no reading on input3 and condition triggered is true (aka sound is playing), set triggered to false, aka stop playing
// STOP WHEN NO TRIGGER IS PRESENT (or do something else ;)