10 Button Midi Transport Controller for Studio One
This is a Transport Controller for the DAW Studio One. influenced by vintage studio reel to reel remotes, but updated.
Components and supplies
3
LED, Blue
1
Hook Up Wire Kit, 22 AWG
3
Through Hole Resistor, 120 ohm
10
Arcade Button with Led
1
Arduino Leonardo
Tools and machines
1
Mastech MS8217 Autorange Digital Multimeter
1
Soldering iron (generic)
1
Solder Wire, Lead Free
1
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Project description
Code
10 button midi controller
arduino
transport controller for Studio one
1 2// If using with ATmega32U4 - Micro, Pro Micro, Leonardo... 3#include 4 <Control_Surface.h> 5 6USBMIDI_Interface ardy2; 7 8///////////////////////////////////////////// 9// 10 buttons 11const int NButtons = 10; //* 12const int buttonPin[NButtons] = {0,1,2,3,4,5,6,7,8,9}; 13 //* the number of the pushbutton pins in the desired order 14int buttonCState[NButtons] 15 = {0}; // stores the button current value 16int buttonPState[NButtons] 17 = {0}; // stores the button previous value 18 19///////////////////////////////////////////// 20// 21 debounce 22unsigned long lastDebounceTime[NButtons] = {0}; // the last time the 23 output pin was toggled 24unsigned long debounceDelay = 13; //* the debounce 25 time; increase if the output flickers 26 27byte midiCh = 11; //* MIDI channel 28 to be used 29byte note = 1; //* Lowest note to be used 30byte cc = 1; //* Lowest 31 MIDI CC to be used 32/////////////////////////////////////////////// 33//record 34 led 35NoteLED noteLed { 10,{ MIDI_Notes::B(6),CHANNEL_1}}; 36//play led 37NoteLED 38 noteLedp { 11,{ MIDI_Notes::Bb(6),CHANNEL_1}}; 39//back light 40 41 42void setup() 43 { 44 45 pinMode(12, OUTPUT); 46digitalWrite(12, HIGH); 47 for (int i = 0; i 48 < NButtons; i++) { 49 pinMode(buttonPin[i], INPUT_PULLUP); 50 51 Control_Surface.begin(); 52 53 54 } 55 56 57} 58 59void loop() { 60 61 buttons(); 62 63 64 Control_Surface.loop(); 65 66} 67 68///////////////////////////////////////////// 69// 70 BUTTONS 71void buttons() { 72 73 for (int i = 0; i < NButtons; i++) { 74 75 76 buttonCState[i] = digitalRead(buttonPin[i]); 77 /* 78 // Comment 79 this if you are not using pin 13... 80 if (i == pin13index) { 81 buttonCState[i] 82 = !buttonCState[i]; //inverts pin 13 because it has a pull down resistor instead 83 of a pull up 84 } 85 // ...until here 86 */ 87 if ((millis() 88 - lastDebounceTime[i]) > debounceDelay) { 89 90 if (buttonPState[i] != buttonCState[i]) 91 { 92 lastDebounceTime[i] = millis(); 93 94 if (buttonCState[i] 95 == LOW) { 96 97 // use if using with ATmega32U4 (micro, pro 98 micro, leonardo...) 99 100 101 controlChange(midiCh, 102 20 + i, 127); // manda control change (channel, CC, value) 103 104 MidiUSB.flush(); 105 106 107 Serial.print("button on >> "); 108 Serial.println(i); 109 110 } 111 else { 112 113 // use if using with ATmega32U4 114 (micro, pro micro, leonardo...) 115 116 117 controlChange(midiCh, 118 20 + i, 0); // manda control change (channel, CC, value) 119 120 MidiUSB.flush(); 121 122 123 // Serial.print("button off >> "); 124 // Serial.println(i); 125 126 } 127 buttonPState[i] = buttonCState[i]; 128 } 129 } 130 131 } 132} 133 134 135 136///////////////////////////////////////////// 137// Arduino 138 (pro)micro midi functions MIDIUSB Library 139void noteOn(byte channel, byte pitch, 140 byte velocity) { 141 midiEventPacket_t noteOn = {0x09, 0x90 | channel, pitch, velocity}; 142 143 MidiUSB.sendMIDI(noteOn); 144} 145 146void noteOff(byte channel, byte pitch, byte 147 velocity) { 148 midiEventPacket_t noteOff = {0x08, 0x80 | channel, pitch, velocity}; 149 150 MidiUSB.sendMIDI(noteOff); 151} 152 153void controlChange(byte channel, byte control, 154 byte value) { 155 midiEventPacket_t event = {0x0B, 0xB0 | channel, control, value}; 156 157 MidiUSB.sendMIDI(event); 158}
10 button midi controller
arduino
transport controller for Studio one
1 2// If using with ATmega32U4 - Micro, Pro Micro, Leonardo... 3#include <Control_Surface.h> 4 5USBMIDI_Interface ardy2; 6 7///////////////////////////////////////////// 8// buttons 9const int NButtons = 10; //* 10const int buttonPin[NButtons] = {0,1,2,3,4,5,6,7,8,9}; //* the number of the pushbutton pins in the desired order 11int buttonCState[NButtons] = {0}; // stores the button current value 12int buttonPState[NButtons] = {0}; // stores the button previous value 13 14///////////////////////////////////////////// 15// debounce 16unsigned long lastDebounceTime[NButtons] = {0}; // the last time the output pin was toggled 17unsigned long debounceDelay = 13; //* the debounce time; increase if the output flickers 18 19byte midiCh = 11; //* MIDI channel to be used 20byte note = 1; //* Lowest note to be used 21byte cc = 1; //* Lowest MIDI CC to be used 22/////////////////////////////////////////////// 23//record led 24NoteLED noteLed { 10,{ MIDI_Notes::B(6),CHANNEL_1}}; 25//play led 26NoteLED noteLedp { 11,{ MIDI_Notes::Bb(6),CHANNEL_1}}; 27//back light 28 29 30void setup() { 31 32 pinMode(12, OUTPUT); 33digitalWrite(12, HIGH); 34 for (int i = 0; i < NButtons; i++) { 35 pinMode(buttonPin[i], INPUT_PULLUP); 36 37 Control_Surface.begin(); 38 39 } 40 41 42} 43 44void loop() { 45 46 buttons(); 47 48 Control_Surface.loop(); 49 50} 51 52///////////////////////////////////////////// 53// BUTTONS 54void buttons() { 55 56 for (int i = 0; i < NButtons; i++) { 57 58 buttonCState[i] = digitalRead(buttonPin[i]); 59 /* 60 // Comment this if you are not using pin 13... 61 if (i == pin13index) { 62 buttonCState[i] = !buttonCState[i]; //inverts pin 13 because it has a pull down resistor instead of a pull up 63 } 64 // ...until here 65 */ 66 if ((millis() - lastDebounceTime[i]) > debounceDelay) { 67 68 if (buttonPState[i] != buttonCState[i]) { 69 lastDebounceTime[i] = millis(); 70 71 if (buttonCState[i] == LOW) { 72 73 // use if using with ATmega32U4 (micro, pro micro, leonardo...) 74 75 76 controlChange(midiCh, 20 + i, 127); // manda control change (channel, CC, value) 77 78 MidiUSB.flush(); 79 80 Serial.print("button on >> "); 81 Serial.println(i); 82 } 83 else { 84 85 // use if using with ATmega32U4 (micro, pro micro, leonardo...) 86 87 88 controlChange(midiCh, 20 + i, 0); // manda control change (channel, CC, value) 89 90 MidiUSB.flush(); 91 92 // Serial.print("button off >> "); 93 // Serial.println(i); 94 } 95 buttonPState[i] = buttonCState[i]; 96 } 97 } 98 } 99} 100 101 102 103///////////////////////////////////////////// 104// Arduino (pro)micro midi functions MIDIUSB Library 105void noteOn(byte channel, byte pitch, byte velocity) { 106 midiEventPacket_t noteOn = {0x09, 0x90 | channel, pitch, velocity}; 107 MidiUSB.sendMIDI(noteOn); 108} 109 110void noteOff(byte channel, byte pitch, byte velocity) { 111 midiEventPacket_t noteOff = {0x08, 0x80 | channel, pitch, velocity}; 112 MidiUSB.sendMIDI(noteOff); 113} 114 115void controlChange(byte channel, byte control, byte value) { 116 midiEventPacket_t event = {0x0B, 0xB0 | channel, control, value}; 117 MidiUSB.sendMIDI(event); 118}
Downloadable files
wiring diagram
10 button midi controller
wiring diagram

Comments
Only logged in users can leave comments