Introduction: Microbit Midi CC Wireless Controller
In this guide we'll create a wireless midi CC controller, allowing you to use your Microbit as a midi controller and connect it to your favourite music production software.
What is Midi CC?
Often abbreviated CC, while the correct term is "Control Change") A category of MIDI messages which are used to convey performance or patch data for parameters other than those which have their own dedicated message types (note on, note off, aftertouch, polyphonic aftertouch, pitch bend, and program change).
Please note this tutorial is designed for Mac, however it should also work for PC. Please leave a comment if you spot any issues regarding PC compatibility and I'll happily update the guide.
- Microbit x2
- Hairless MidiSerial
- Logic Pro X (or any DAW of your choice)
Step 1: Sending the Accelerometer Data
Since ultimately we'll want to be able to move wirelessly, we'll need two microbits. One to capture our accelerometer data and send it over the microbit's radio, and another to receive the data and output it as MIDI CC whilst connected to our computer.
First, lets code the capture device. We'll be capturing the pitch and roll values from the microbit's accelerometer, and then transmitting these over radio. However there's no reason why you couldn't use the variety of other inputs on the microbit, such as its buttons or even the compass!
For a full list of the MIDI capabilities of the Microbit, please view the official documentation here.
Step 2: Receiving Data and Converting to Midi
With our second Microbit connected to the computer via USB, this will receive our accelerometer data over radio and convert into our MIDI CC values.
The important block here is Use Midi Serial, which allows us to use a bridge application and route the midi cc internally within the computer.
Midi CC has 120 Channels available (0 to 119), however for this demo we'll only be using two - Channel 0 and Channel 1, with these assigned to Pitch and Roll respectively.
Both pitch and roll measure from -180 to 180 and whilst Midi CC values can be 0 to 127, so I'm using the 'map' block to convert the data ranges. I recommend playing with this number conversation process once you know which parameter you'll want to control as you might only want values within a certain range (depending on the effect you're controlling).
For more information about remote data collection with the microbit, see here.
Step 3: Setting Up Your Computer
To route the Midi signal from your microbit to your DAW of choice, you'll need a bridge application such as Hairless MidiSerial - download this for free from the GitHub page here.
Audio Midi Setup
Note: If you're using a Mac, ensure you select your MIDI Out as "IAC Bus 1". If this doesn't appear in the list, you'll need to open you Audio MIDI Setup, navigate to the MIDI Studio (from the window menu at the top), click on IAC Driver ensure the 'Device is Online' box is ticked.
Step 4: Assigning Parameters in Your DAW
As a Logic Pro X user, I'll be focusing on this software - however from my understanding it should work similarly on your DAW of choice.
Make sure Logic is set to receive the MIDI In from the IAC Bus, this can be checked in the preferences > Midi > inputs. Pick which parameter you want to control, for example a synthesiser filter cut off, auxiliary channel send amount or EQ frequency. Then, give this parameter a wiggle and then press CMD+L. Now, when you move your Microbit, it will automatically assigned the respective MIDI CC Channel to that parameter.
PLEASE NOTE with my code, since we're using two values its constantly sending a value for both CC channels (0 and 1) and as such Logic gets very confused when you try to assign a parameter. I plan to improve the code so its not sending a value if the number is the same (or within a small range), however until then I recommend removing one of the "ifs" in the receiver code so that Logic is only receiving one MIDI CC value at a time during this assigning stage.
In Logic you can also fine tune the MIDI Controller further, adjusting the input with a multiply value, setting min and max values. The values I used for the EQ High Cut can be seen on the image above.
Step 5: What Next?
Congratulations! Now you should be controlling logic with your microbit...wirelessly!
Theres SO much possible with MIDI and the Microbit. You could setup different "scenes" on the microbit, allowing you to change which CC Channel each accelerometer value is controlling based on a button press on the sender microbit. Giving a performer full control over a variety of instruments. MIDI can also do far more than music too, with some lighting desks also MIDI enabled.
Shout out to other musical microbit makers
Here are some of my favourite makers pushing the boundaries of what's possible with the fantastic piece of hardware.
How to connect your microbit to Pure Data by Vulpestruments
Microbit Orchestra by Captain Credible
Microbit Guitar by David Whale