Midi/Arduino controller?

Hi all. I am very new to Arduino and am attempting to make a MIDI controller that works with a microphone for my band. I think I've been posting this in the wrong forum as this seems to be the one I'm looking for. I apologize. I am very new here.

I've taken to Arduino pretty well and have everything wired up right, it's the code that is killing me as I never really have messed with code before. And MIDI language on top of that has been tough to decipher. I have most of the code cracked as it's playing notes right now. But I don't really want it to play notes, just to load a .vst effect on a button press.

The controller has 3 buttons ( 2 will produce a .vst plugin effect and 1 is to turn it off) and one force sensor which will bend the pitch depending on how hard it is pressed. I am using a demo of Energy XT2 as the MIDI software.

I have the buttons/sensor playing random notes right now but don't really understand how to assign a .vst plugin to be triggered on a button press. Any MIDI wizards out there that can help a MIDI/Arduino beginner? The code I'm using is below. It currently plays C, D, E, F notes on press. Any help would be very much appreciated. Thanks!

// define the pins int switchPin1 = 4; int switchPin2 = 3; int switchPin3 = 2; int switchPin4 = 0;

// general midi notes char note1 = 60; //Middle C char note2 = 62; //D char note3 = 64; //E char note4 = 65; //F

// Variables int switchState1 = LOW; int switchState2 = LOW; int switchState3 = LOW; int switchState4 = LOW;

int currentSwitchState1 = LOW; int currentSwitchState2 = LOW; int currentSwitchState3 = LOW; int currentSwitchState4 = LOW;

void setup() {

// set the states of the I/O pins: pinMode(switchPin1, INPUT); pinMode(switchPin2, INPUT); pinMode(switchPin3, INPUT); pinMode(switchPin4, INPUT);

// set MIDI baud rate : Serial.begin(31250);

}

void loop() {

//switchPin1 currentSwitchState1 = digitalRead(switchPin1); if( currentSwitchState1 == LOW && switchState1 == HIGH ) // push //Note on channel 1 (0x90), some note value (note), middle velocity (0x45): noteOn(0x90, note1, 0x45); if( currentSwitchState1 == HIGH && switchState1 == LOW ) // release //Note on channel 1 (0x90), some note value (note), silent velocity (0x00): noteOn(0x90, note1, 0x00); switchState1 = currentSwitchState1;

//switchPin2 currentSwitchState2 = digitalRead(switchPin2); if( currentSwitchState2 == LOW && switchState2 == HIGH ) // push //Note on channel 1 (0x90), some note value (note), middle velocity (0x45): noteOn(0x90, note2, 0x45); if( currentSwitchState2 == HIGH && switchState2 == LOW ) // release //Note on channel 1 (0x90), some note value (note), silent velocity (0x00): noteOn(0x90, note2, 0x00); switchState2 = currentSwitchState2;

//switchPin3 currentSwitchState3 = digitalRead(switchPin3); if( currentSwitchState3 == LOW && switchState3 == HIGH ) // push //Note on channel 1 (0x90), some note value (note), middle velocity (0x45): noteOn(0x90, note3, 0x45); if( currentSwitchState3 == HIGH && switchState3 == LOW ) // release //Note on channel 1 (0x90), some note value (note), silent velocity (0x00): noteOn(0x90, note3, 0x00); switchState3 = currentSwitchState3;

//switchPin4 currentSwitchState4 = analogRead(switchPin4); if( currentSwitchState4 == LOW && switchState4 == HIGH ) // push //Note on channel 1 (0x90), some note value (note), middle velocity (0x45): noteOn(0x90, note4, 0x45); if( currentSwitchState4 == HIGH && switchState4 == LOW ) // release //Note on channel 1 (0x90), some note value (note), silent velocity (0x00): noteOn(0x90, note4, 0x00); switchState4 = currentSwitchState4; }

// Send a MIDI note-on/off message. void noteOn(char cmd, char data1, char data2) { Serial.print(cmd, BYTE); Serial.print(data1, BYTE); Serial.print(data2, BYTE); }

You need to figure out what MIDI message the software expects to activate the vst effect. This should be in the softwares documentation, if it is at all possible.

It's probably one of the MIDI controler messages.

I haven't tackled MIDI on the arduino, but I do a lot of work with MIDI and just thought I'd suggest this program to you during your work:

http://www.midiox.com/

It is kind of the standard for debugging any MIDI setups as it is a very quick easy way to to view the raw MIDI data coming from any device. It sure beats also wondering if you have some host setup properly, VST receiving MIDI, which notes are being sent, etc...

Hope this helps, and enjoy!

There is also the MIDI Library (updated):

http://www.arduino.cc/playground/Main/MIDILibrary