I am interested in making MIDI controllers to communicate with virtual instruments or a DAW.
I had to spend a fair amount of time figuring out what works for my setup.
I would like to offer the little bit of knowledge I have gathered thus far that may save you some troubles.
I have Arduino Uno, latest revision, a laptop running Windows 7 Professional and some old version of Ableton Live. I am just using the laptop's standard sound card. I am not using any extra hardware or specialized cables, only the USB cable connected from the Arduino to the laptop.
(This is a good time to mention that you can only use the USB connection from the Arduino to the PC for one thing at a time. Meaning you can upload a sketch, or send serial data.It is doing one or the other, but not both at the same time.)
I set out to create a very simple controller that I can expand upon as I learn how to code.
Before we venture into different ways to trigger MIDI, there is a simple sketch below that does not require any sort of extra input such as buttons, knobs, or force sensing resistors. It is a great way to test your setup.
I found that I needed 2 pieces of software for my Arduino to communicate with the audio software:
- Hairless MIDI The Hairless MIDI<->Serial Bridge
- LoopBe1 LoopBe1 - A Free Virtual MIDI Driver
DO NOT RUN HAIRLESS MIDI UNTIL AFTER YOU UPLOAD THE SKETCH TO THE ARDUINO AND HAVE STARTED THE AUDIO SOFTWARE!!!!!!!!
In case that's not clear:
- Upload sketch
- Start your audio software of choice (I will assume you know how to setup audio and MIDI Ins/Outs for your DAW/VST of choice.)
- Open Hairless
LoopBe1 kinda runs in the background so you don't have to do anything with it.
Here is a sketch from http://www.instructables.com/id/Arduino-Sensors-and-MIDI/?ALLSTEPS
that can serve as a good test to confirm you have the proper setup/configuration from Arduino to PC to Serial Bridge:
Step 3: Generating MIDI with Arduino
(Upload the following code onto the Arduino, it turns MIDI note 60 (middle C) on, waits for 300ms, then turns it off and waits for another 200ms:
byte noteON = 144;//note on command
void setup() {
Serial.begin(9600);
}
void loop() {
MIDImessage(noteON, 60, 100);//turn note on
delay(300);//hold note for 300ms
MIDImessage(noteON, 60, 0);//turn note off (note on with velocity 0)
delay(200);//wait 200ms until triggering next note
}
//send MIDI message
void MIDImessage(byte command, byte data1, byte data2) {
Serial.write(command);
Serial.write(data1);
Serial.write(data2);
}
You may have to mess around with the Baud rate settings in Hairless as well as the sketch for things to start communicating properly. However, for this sketch, the prescribed setting should do just fine.You should see some blinky lights on the Hairless GUI indicating that Arduino is indeed sending bytes to the laptop and that MIDI in is seeing them. Then you should hear some sounds coming from your laptop, pc, sound card,IO device, etc.
Don't forget to close Hairless MIDI before you try to upload any changes to the Arduino.
If you hear middle C turning on and off, Congratulations, everything is communicating.
My next mission is to figure out how to setup a couple of buttons to turn on MIDI notes so that I will have the ability to play a melody or whatever on a virtual instrument.
If anyone finds this thread helpful or can offer further guidance on the subject, please post a comment.
I will try to add to this post as I learn more and have more to share.
Thanks