Introduction: Controlling Cubase With Arduino Based MIDI

A friend of mine wanted to control Cubase, his audio recording software, with a push button so that he could stop and start recordings remotely without having to go over to the computer and type on the keyboard. You may be able to do this in other recording software, we just happen to use Cubase.

Step 1: What You Need

Normally open push buttons (one for every action you want to perform like these)
10K-Ohm resistor (one for every button)
Arduino with a good solid 5V. I had to externally power mine (I'm using the bare-bones version running Diecimila) get it here
Solderless breadboard (like this one)
MIDI jack (you only need one, since all you're doing is sending like a dis)
220-Ohm resistor (for the MIDI jack)
Computer running Cubase or some other recording software
MIDI Cable (here's a 20'er)
You may need a USB to MIDI input, I have used and liked, this one, and this one

Step 2: Hardware Setup

Schematic and pic attached. NOTE: the schematic is the work of ITP Physical Computing

Basically it's 5V to switch, switch to control pin, 10K resistor from control pin to GND
For the MIDI jack it's pin 5 to serial pin, pin4 to 5V through the 220 resistor
Load the following sketch on your Arduino:
{{{
/* Convert Arduino to a MIDI controller using as many digital inputs
* as you need.
*
* This sketch is set up to send 2 MIDI notes on MIDI channel 5,
* but it can be easily reconfigured for other notes and channels
*
* Created 3 Nov 2008
* By Hyeki Min
*
* Modified 14 May 2009
* By Petyr Stretz
* Changed switch logic so that the pin low and high made the
* notes play like a keyboard, removed unneeded pins, changed
* output MIDI channel to 5
*
* Modified 15 April 2014
* By Petyr Stretz
* Instructables user Andrew.Wilson.7 reported BYTE is no
* longer used in Arduino 1.0 or later. Removed it from noteOn()
*/

// define the pins we use, MIDI port is always on Arduino pin 1 (TX)
int switchPin1 = 2;
int switchPin2 = 3;

// general midi notes
char note1 = 60; //Middle C
char note2 = 62; //D

// Variables
int switchState1 = LOW;
int switchState2 = LOW;
int currentSwitchState1 = LOW;
int currentSwitchState2 = LOW;

void setup() {
// set the states of the I/O pins:
pinMode(switchPin1, INPUT);
pinMode(switchPin2, INPUT);

// set MIDI baud rate :
Serial.begin(31250);
}
void loop() { //switchPin1
currentSwitchState1 = digitalRead(switchPin1);
if( currentSwitchState1 == HIGH && switchState1 == LOW ) // push
//Note on channel 5 (0x94), some note value (note), middle velocity (0x45):
noteOn(0x94, note1, 0x45);
if( currentSwitchState1 == LOW && switchState1 == HIGH ) // release
//Note on channel 5 (0x94), some note value (note), silent velocity (0x00):
noteOn(0x94, note1, 0x00);
switchState1 = currentSwitchState1; //switchPin2
currentSwitchState2 = digitalRead(switchPin2);
if( currentSwitchState2 == HIGH && switchState2 == LOW ) // push
//Note on channel 5 (0x94), some note value (note), middle velocity (0x45):
noteOn(0x94, note2, 0x45);
if( currentSwitchState2 == LOW && switchState2 == HIGH ) // release
//Note on channel 5 (0x94), some note value (note), silent velocity (0x00):
noteOn(0x94, note2, 0x00);
switchState2 = currentSwitchState2;
}// Send a MIDI note-on/off message.
void noteOn(char cmd, char data1, char data2) {
Serial.print(cmd);
Serial.print(data1); Serial.print(data2);
}
}}}

Step 3: Software Setup

Cubase is able to be set up for a generic remote that can convert MIDI notes to actions. The screenshots are from Cubase 3, although they shouldn't be that different in the other versions. Check your manual for other recording software.

Under the Devices menu choose "Device Setup."

When the device setup window appears, Click the plus sign to add a control and choose "Generic Remote" NOTE: depending on the version, you may need to choose the remote on the right side and click and arrow to add it to the left.

After clicking on "Generic Remote" in the Device list the window should look like the third screen capture below.

Set your MIDI input from the drop list, it will most likely be different than mine, and click on the first "Fader 1" in the top box.

Make sure your remote is hooked up and running, click and hold the "Learn" button and press one of the remote buttons then let go of "Learn." You should see the MIDI channel and Address change to match mine, unless you modified the code. Do the same for Fader 2 and so on for however many buttons you need. Change the Max Value to "1," I didn't do that before taking the screen shot.

In the lower box you set what the control is going to do. There are a ton of choices, but we just need Record and Stop. Choose "Command" off the Device drop list, "Transport" off the Channel/Category drop list and then your corresponding action from the Value/Action drop list. Just clicking in the box you want to change should open the drop lists.

Now you should be all set. Choose rename to name the control something obvious, like TRANSPORT, and hit Apply, then OK.

Finally, click the devices menu and choose Generic Remote. Make sure your control is selected and you should be all set to use it.

NOTE: I ran into an issue with Learn not recognizing any notes I hit. There is a Reset Devices button next to the + and -, once I hit that everything worked.

Step 4: Bibliography

Because I believe in giving credit where credit is due:

http://itp.nyu.edu/physcomp/Tutorials/MusicalArduino - Arduino to MIDI note out
http://www.indiana.edu/~emusic/etext/MIDI/chapter3_MIDI4.shtml - MIDI note info
http://www.dancetech.com/article.cfm?threadid=172 - Configuring Cubase