/* * * GABBER KICK auto-kick (internal kick) * * // A2 sets pitch and delay of ATTACK (timbre) * // A1 sets pitch and delay of SUSTAIN (actual phatness) * // A0 sets kick speed (trigger) */ #define SPEAKER_PIN 11 bool triggered; // logic: trigered, yes or no void setup() { // set pin 11 as output pinMode(SPEAKER_PIN, OUTPUT); Serial.begin(9600); // debugging (see if trigger is registered) Serial.println("i am on"); } void loop() { int input3 = digitalRead(A3); // read analog pin 3 int LFO = analogRead(A0)*2; // read analog pin 1 (note duration 0-2000ms) //fake trigger for(int i=0;i<2;i++){ Serial.println("Got trigger!"); // analogWrite(11,0); //nasty attack try (speaker clip/click) // delay(analogRead(A2)); // analogWrite(11,255); // delay(analogRead(A2)); // analogWrite(11,0); //ATTACK for(int i=0;i<10;i++){ // i = DELAY+SUSTAIN+RELEASE of ATTACK analogWrite(11,0); 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(int i=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); } delay(LFO); //fake trigger delay time } }