I'm totally new to this so there are a number of things about to follow that will be very noob.
I have bought an arduino unit in hop of ehooking up my rock band drum kit and playing Ableton live via midi through the serial port.
I have all the parts but the code side of things has me confused. I cannot code but was told I could just find someone else's sketch (is that the right term?) and just paste it into the software and I'd be fine.
But there are so may out there I don't know how you know which cot choose..?
I spoke to the person who told me I could just paste one an they have since told me not to do that and that I must custom write one just for my board. I told them I didn't know how to epoch they added "after I have written the sketch , I need to find a library to attach to the end of it and only then will my code run"
The more i ask them about it the more complex it gets and they suggested it is beyond . They have offered to take the arduino off my hands if I decide to give up….(I have now become suspect of their intentions) but am still at the point of not knowing where to start . I have various coding used by people but am not sure if it is as simple as just pasting it into the software and I'm set.
Any advice or tips ?
I was looking at this code to try
//Piezo midi drum code by Jacob Clarke
int drumPins[] = {A2,A1,A4,A5}; // my A3 pin stopped working somehow
int drumVals[4];
int ledPins[] = {8,9,10,11};
int minPin = A0;
int drumNotes[] = {17,48,43,52};
int minPot = 0;
int minVal = 0;
int maxPot = 0;
int maxVal = 130;
int drumWait[] = {0,0,0,0};
int waitTime = 200; //milliseconds
boolean debug = false;
void setup() {
if(debug) Serial.begin(9600);//correct speed for serial monitoring
else Serial.begin(31250);//correct speed for MIDI
//init LEDs
for(int i=0; i<sizeof(ledPins); i++) {
pinMode(ledPins[i], OUTPUT);
}
}
void loop() {
minPot = analogRead(minPin);
//loop through pads
for(int i=0; i<sizeof(drumPins); i++) {
if(drumWait[i] > 0) {
drumWait[i]--;
//power LED during wait time
int bright = map(drumWait[i],0,waitTime,0,400);
if(bright > 255) bright = 255;
analogWrite(ledPins[i],bright);
}else if(drumWait[i] == 0) {
if(!debug) {
//trigger note off at the end of wait time
Serial.write(0x80);
Serial.write(drumNotes[i]);
Serial.write(0x00);
}
drumWait[i]--;
}else{
//check piezo value and compare to minimum velocity
int val = analogRead(drumPins[i]);
if(val > minPot) {
//map the piezo hit to a 127 midi velocity value
drumVals[i] = map(val,minPot,maxVal,30,127);
if(drumVals[i] >= 128) drumVals[i] = 127;
if(debug) {
Serial.print(i);
Serial.print(" Drum = ");
Serial.println(drumVals[i]);
}else{
//trigger note on for predetermined MIDI note
Serial.write(0x90);
Serial.write(drumNotes[i]);
Serial.write(drumVals[i]);
}
drumWait[i] = waitTime;
}
}
}
}
thanks to the original author