Building a MIDI Controller Using Arduino

Hi everybody. My name is Daniel…and I’m not a musician. It’s a difficult thing to admit, but I just
do not have a musical bone in my body. That doesn’t stop me from trying though! I do enjoy making random sounds for no other
reason than to entertain myself. The only problem with my current MIDI keyboard
is simply that it doesn’t have enough inputs. So, let’s fix that, and build a MIDI controller
powered by an Arduino! Okay, to start off, what the heck is this
MIDI I keep talking about? Brace yourself for some quick theory, and
I promise you some more tangible making will come later in the video. MIDI is a huge topic to cover, but it is essentially
both a communications protocol, a type of digital interface and a type of connector
all rolled into one. It’s a way to connect electronic instruments
together, sending information inbetween them, and interpreting them to eventually make sounds,
to make music. For all intents and purposes MIDI in this
video will only be seen as a communications protocol, as we will use an Arduino to “speak”
MIDI via USB to a DAW, a Digital Audio Workstation, on the computer. It’s important to note though that MIDI does
not transfer any actual audio, but only transfers data enabling devices to speak with one another. Don’t worry, I will cover this more in detail
later. Looking at different MIDI devices we have
everything from electronic keyboards, synthesizers, drum machines, samplers and various effect
devices. The reason why I’m making this device is because
my electronic keyboard simply does not have enough controls for me to easily adjust various
aspects in my DAW. For instance if I want to change the sustain
of the instrument I’m playing I have to physically take my mouse and alter that parameter of
the instrument. Using a knob on a separate controller mapped
to the sustain value of the instrument would be much easier, and that is something that
can be done easily using MIDI. That’s just scraping the surface though, as
there are many more parameters that can be controlled using digital knobs and controls
which could be beneficial to break out into a tangible interface. So when it comes to selecting what you want
in your MIDI controller the sky is literally the limit. If you can use your Arduino to read it you
can probably interpret it in some way to send it as a MIDI event to your computer. Personally I want a lot of buttons, to be
able to make something like a drum pad, and this old phone keypad will do just awesomely! The job of the knobs will be played by a few
potentiometers, but we’re also adding some more bells and whistles, including a joystick,
which I will go into a bit later. Once you’ve decided what to put into your
MIDI controller I highly encourage you to build functional prototypes. Make sure you can get your Arduino to send
MIDI events properly using the inputs you have chosen. There is a lot of information online about
what goes into a MIDI event message, and how to use your Arduino to send it to your computer. I won’t go into that in this video too deeply,
but I will leave some useful links in the description. Now, for something a bit more tangible. Once you’ve chosen what you want as inputs
and verified that they work, we need something to house them in. You could just take a cardboard box, or a
cookie tin, or anything even remotely box shaped, and mount your hardware in there. Me, I want to go a little bit more fancy. Let’s break out the laser cutter, start up
the woodworking montage music and let er rip! With all that done and dusted lets install
some electronics! There are different ways to go by this, to
either completely make the circuitry outside the enclosure, test it and then install everything
into the box. I chose the slightly more chaotic way of installing
the components without attached wires, heck even without programming everything as one
coherent unit, and I will do all my soldering and connection in situe. It will be a little bit more cramped to work
like that, but will ensure that I can run wires a bit more efficiently, and it’s a lot
more easy to install individual components without everything connected. Some of the components attach with just a
nut on the other side of the hole, or with screws through the top, but the keypad as
well as the rotary encoders I used has no such thing. Therefore some extra parts were glued in the
back to allow them to be held in by screws from the inside of the box. Because all of the different inputs I chose
require a lot of pins on the Arduino a simple Arduino UNO board would unfortunately not
suffice for this project. Luckily there is a big brother to the UNO,
the Arduino MEGA, which comes with 54 digital pins, and 16 analog pins, as opposed to the
UNO’s 14 and 6. So it should be more than enough for what
I need to do! Is it time for another montage? I can feel it building up! Let’s do it! A wiring and soldering montage! Here we gooooooooo! I know I kind of brushed over all of this,
but at the end of the day how you wire your project will differ from how I wired mine,
so the relevance of a step by step instruction is limited. If you’re feeling especially creative though,
especially if you’re building something a bit more permanent, why not take the time
to design your own circuit board shield for the Arduino to make connecting the whole project
a lot more easy and robust. Order your PCB from PCBWay today! Since it’s the holiday season they’re offering
both $10 off your order, as well as a free mystery gift in your package all the way until
the end of 2019! PCBWay recently celebrated their five year anniversary, and with the
quality they’re delivering I’m sure they will be around for a long time to come! Anyway, once you have everything attached,
and all the wires connected properly, you can actually get to properly program this
thing. As you may recall I built some functional
prototypes, but they only really have snippets of code for each individual part. It’s now time to bring it all together! I will not dive deep into the Arduino code
either, but if you want you can download the Arduino sketch from the link in the description,
I tried to comment it as much as possible to make it not too difficult to understand. The focus was though to get my MIDI controller
to work, not to make neat and beautiful code. The basic idea behind the code is to read
the various controls as inputs, map those inputs into a format that a DAW can understand,
in other words MIDI, and output it over a USB serial connection to the computer. It does take a lot of going back and forth,
making small incremental steps and changes making sure each part works properly before
moving onto the next. I did end up wiring some stuff up backwards,
but that is easily fixable in code if you don’t feel like breaking out the soldering
iron again. To get the Arduino to actually communicate
with your computer using MIDI we will need two more pieces of software. The first is called loopMIDI, and we can essentially
think of it as a virtual MIDI cable. It is what we will see in our DAW as a MIDI
input device. To be able to send our MIDI serial data to
the loopMIDI software we need a program called Hairless MIDI To Serial Bridge, which does
exactly what the name suggests, and I guess it’s hairless. It reads MIDI events sent over a serial port
and bridges it over to loopMIDI so the data is visible in our DAW. Okay, I’ve said DAW so many times now. DAW stands for Digital Audio Workstation,
and it’s essentially a piece of software which you use for recording, editing and producing
audio and music. There are lots and lots of different DAWs,
some simple and some very complex. For more information I can only suggest checking
out the links in the description. For this video I will be using Ableton Live,
which is a popular and fairly straight forward DAW. I will not be doing any recording, but rather
only using it to recieve MIDI and make sounds with its built in instruments and VST plugins. Whatever you choose to do with it from there
is up to you! But enough with the technical aspects, let’s
see what all these controls can do! Waaaaaait! Waaaait a minute! There’s one very important step left. We just can’t leave the controller looking
like this! Bring on THE KNOBS!!! Much better indeed! Now we are ready to start playing around! In Ableton it’s extremely easy to map a MIDI
controller to almost anything in the interface. Make sure the little indicator up at the top
right is blinking when you use your controller, that indicates that there are MIDI events
being received. Next click the MIDI button next to it and
parts of the interface will change color. Clicking on any of these and then moving the
controller you want to attach it to will bind those two together. Do the same for other things you want to attach,
and click the MIDI button again when you’re done. Now you’re ready to either use it as an instrument
by itself, with the built in keypad, or use it alongside your MIDI keyboard to adjust
various aspects of your instrument as you’re chasing that perfect sound. And as we know, there are no shortcuts to
the perfect sound, but this is one step in the right direction. I’m using an excellent free VST plugin called
Ragnarök which is emulating an analog synthesizer from the 80s. I’ve mapped many of the different knobs in
the plugin to the different knobs on the controller. Even though we only have six knobs on the
controller one of them holds a secret. The top left one is a rotary switch, with
six positions. Flipping this to different positions changes
the two rotary encoders over to occupy other modes, essentially making these two knobs
into twelve, just not simultaneously. The joystick works the same as you would expect
the pitch and modulation wheels on a regular MIDI keyboard to work, but you can definitely
set the up to do other things if you so desire. They keypad can be used essentially as keyboard
keys. The little switch transposes, or moves, the
keys of the keypad up or down an octave, making it possible to play the full gamut of notes
of a keyboard with just these twelve keys. Though, it may make a whole lot more sense
to use the keypad as a drump pad rather than an actual keyboard. That’s about all there is to it, so instead
of me torturing you with my lack of musical artistry, grab an Arduino, set forth out into
the world, and get MIDIing! Thank you for watching, I really hope you
like this video, as I have others along a similar vein planned in the future. Until then check out some other videos, subscribe
if you haven’t and why not take a gander at what’s happening on instagram? Until next time!

Leave a Reply

Your email address will not be published. Required fields are marked *