Go Down

Topic: Help with sketch for midi drum kit (Read 1 time) previous topic - next topic

Urbano

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
Code: [Select]
//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

Slightlygrim

Hi

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:

http://arduino.cc/en/Tutorial/Midi?from=Tutorial.MIDI

Hope this helps

Thanks

peppesicurella

Hi

exist some way to connect ARDUINO as  midi controller via his own usb/power connection in a way to connect  3 push button to several pin to act like midi push button controller   ??

polymorph

Did you look at the MIDI tutorial linked in post 2?
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - tinyurl.com/q7uqnvn
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

peppesicurella

yup but i was lookingofr something else thank you the same :&

polymorph

If your question is very different from the original thrust of this thread, you would benefit from starting your own thread with a relevant subject line.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - tinyurl.com/q7uqnvn
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

peppesicurella

Hey @polymorph i followed your suggest
i started a new post .thank you, check this one
http://forum.arduino.cc/index.php?topic=267061.msg1883032#msg1883032

JustinSerf

#7
Jun 29, 2015, 06:42 pm Last Edit: Jun 30, 2015, 12:56 pm by JustinSerf
Here is a sketch i made that might help, its very simple, just follow my notes and you should be fine.

code is made for Hihat... Kick... Snare... Crash... Tom1... Tom2... Tom3... and Ride.

ENJOY!

The .ino file is attached.

please reply and tell me what you think!


Go Up