Pages: [1]   Go Down
Author Topic: Help with sketch for midi drum kit  (Read 409 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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) {
      //power LED during wait time
      int bright = map(drumWait[i],0,waitTime,0,400);
      if(bright > 255) bright = 255;
    }else if(drumWait[i] == 0) {
      if(!debug) {
        //trigger note off at the end of wait time
      //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(" Drum = ");
          //trigger note on for predetermined MIDI note
        drumWait[i] = waitTime;
thanks to the original author

Offline Offline
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I'm new to this too but about to finish my first project of the midi sequencer. I personally would recommend starting any project from scratch just cause if you take a project from someone else, unless they give you really full detail of everything they have done, you might do something slightly different and end up spending ages trying to figure out what you have done. Plus you learn so much more from starting from scratch. Also helps if you want to expand or revise your project later on. I would tho recommend taking section of code (arduino tutorials, great for this) you know works and adapting that, save you the hassle of writing out something someone has already done.

Anyway, Is your rock band drums for the wii as I know and have done, you can connect a wii controller via bluetooth to a computer and convert it to midi via an app (OSCulator), Figured it might make things easier than trying to attach an arduino.

If not with regards to your code, I did notice that to me your MIDI code doesn't look right. I'd recommend having a read of the tutorials for arduino and especially the midi section. They can be found here:

Hope this helps


Pages: [1]   Go Up
Jump to: