You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.5 KiB
Arduino

/*
*
* ultra auto GABBER KICK auto-kick (internal kick)
*
* // A2 sets pitch and delay of ATTACK (timbre/double kick)
* // A1 sets pitch and delay of SUSTAIN (actual phatness/pitch/tripple kick)
* // A0 sets kick speed (trigger speed)
*/
#define SPEAKER_PIN D7
#define LED_PIN D4
bool triggered; // logic: trigered, yes or no
void setup() {
// set pin 11 as output
pinMode(SPEAKER_PIN, OUTPUT);
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH);
// int input3 = digitalRead(A3); // read analog pin 3
int LFO = map(analogRead(A0),0,1023,0,50); // read analog pin 1 (trigger well actually note duration 0-1023ms)
//fake trigger (doesnt really work at gabber bpms though...)
for(int i=0;i<1;i++){
//ATTACK
for(int i=0;i<5;i++){ // i = DELAY+SUSTAIN+RELEASE of ATTACK
analogWrite(SPEAKER_PIN,0);
delayMicroseconds(100*i*i); // lower the pitch over time
analogWrite(SPEAKER_PIN,255);
delayMicroseconds(100*i*i); // lower the pitch over time
analogWrite(SPEAKER_PIN,0);
// delay(1);
}
//delay(1);
//SUSTAIN RELEASE
for(int i=0;i<LFO;i++){ // i = DELAY+SUSTAIN+RELEASE < this should be linked to lfo..
analogWrite(SPEAKER_PIN,0);
delayMicroseconds(100*i); // lower the pitch over time
analogWrite(SPEAKER_PIN,255);
delayMicroseconds(100*i); // lower the pitch over time
analogWrite(SPEAKER_PIN,0);
delay(1);
}
}
delay(LFO); //fake trigger delay time
digitalWrite(LED_PIN, LOW);
}