AirMIDI - Hand Motion MIDI Controller Using Arduino
by SuchdeepJ in Circuits > Arduino
3541 Views, 20 Favorites, 0 Comments
AirMIDI - Hand Motion MIDI Controller Using Arduino
Control any MIDI Parameter value of your DAW through Hand Motions (Eg. LFO, Cutoff, Gain)
Idea behind the project:
Hello,
I am a Software Engineer and a Musician and love to explore the area in which I can mix music with tech, While composing music through Logic Pro, I was trying to play with knobs on my plugin to change the LFO levels and it was producing a great techno effect with a 120 BPM Kick sound.
As I didn't had a MIDI Controller I thought of making one myself, Made my first controller using Potentiometer knobs, then thought that the functionality of knob is just to send values from 0-127 and that can be done by any means, that's when I thought of using Ultrasonic sensor for this purpose.
I made this project such that with just keeping hands above the sensor and moving it away/closer from the sensor behaves similar to turning Potentiometer knobs from one side to another.
You can add as many sensors and map those with your DAW to control any MIDI level. For this project I have used two sensors.
What You'll Need!
- 1x Arduino Uno or any other Arduino will work, We just need four Digital I/O Pins and 5V Vcc.
- 2x HC-SR04 Ultrasonic sensor (You can use any number of sensors and make necessary changes in code)
- 8x Jumper Cables (Male to Male)
- 1x Breadboard
- Hairless MIDI Serial Bridge
- Any Digital Audio Workstation (Used Logic Pro for demonstration).
Circuit Diagram
Ultrasonic sensors have a Trigger Pin and Echo pin, We send an ultrasonic pulse through Trigger pin and then Echo Pin waits for receiving it back after bouncing back through any object in front of sensor and calculates distance as per that.
You can use any Digital I/O Pins for connecting Trigger/Echo of Ultrasonic Sensor.
As per the pins used, the variable in the codes related to trigger/echo pins can be updated
(eg. int trigPin1=2; //Pin No. 2 of arduino used as trigger pin for sensor one)
Installing Software
Install Hairless MIDI Serial Bridge (Used for sending and receiving MIDI signals to any serial device)
Mac Users:
- Open Audio MIDI Setup (Search "Audio MIDI Setup" in LaunchPad)
- Click on IAC Driver and make sure that "Device is Online" box is checked as shown in the image.
- Open Hairless MIDI software.
- Make sure in Serial Port arduino's serial port is selected and MIDI Out is set to IAC Driver Bus1.
Windows Users:
- Install LoopBe1 MIDI Driver (Virtual MIDI Driver).
- Open Hairless MIDI Software.
- Make sure in Serial Port arduino's serial port is selected and MIDI Out is set to LoopBe Internal MIDI.
Note: While Uploading code to Arduino make sure that in Hairless MIDI the Serial<->MIDI Bridge On is Unchecked otherwise code won't upload, after uploading code successfully enable the Serial<->MIDI Bridge On again.
Code
The Code of the project can be accessed through the following Github Link: AirMIDIController Github Link.
Important Note:
- The code is developed for two sensors currently but can be extended to any number of Ultrasonic sensors as per the Digital I/O Pins availability. You can extend the project by just copy pasting the code for one sensor.
- While uploading code and mapping MIDI it is recommended to map one Sensor at a time as the Ultrasonic sensors will keep sending values of the object in front so it may get difficult while MIDI Controller Assignment as both sensors will send input to the MIDI Parameter to map.
- To tackle this, comment out code of other sensor/sensors and upload code of one sensor at a time and map it to your desired MIDI parameter(Mapping covered in next steps) and repeat this for other sensor/sensors
- Once You have Mapped both the sensors to your desired parameter then you can upload the full code(with all sensor code uncommented) and Control separate parameters of your Digital Audio Workstation.
MIDI Mapping
- As mentioned in previous step, It is recommended to map One sensor at a time therefore while uploading comment out the code of other sensor and upload it.
- After uploading code open Hairless MIDI and make sure correct Serial Port and MIDI Out are selected.
- The Hairless MIDI should display the incoming values as per the distance at which your hand is placed above the sensor (As shown in the attached image)
- Once the values are visible on Hairless MIDI open your DAW (Logic Pro used for demonstration).
- In your DAW open any Plug In which has different Parameters and Supports MIDI (Used Alchemy for Demonstration).
- Tweak the parameter which you want to control by mouse.
- After you tweak the desired parameter it should be available to be MIDI Mapped and it should be visible in Logic Pro->Control Surfaces->Learn Assignment for....(As shown in the image)
- It will automatically map the incoming MIDI Signal to the desired parameter if Learn Mode is enabled and you will see Learned displayed for your desired MIDI parameter (As shown in the image)
- After mapping one sensor, uncomment the code of other sensor and comment the code for the sensor for which assignment is done and upload the code.
- Follow above mentioned steps for other sensor to map it to any other parameter of the plugin.
- After both sensors are mapped, Uncomment the code of both the sensors and upload the code.
- Now you should be able to see both the parameters being changed on your DAW as per your hand motion in front of the sensors.
Demo Time!
Here is a quick demo of the AeroMIDI Controller in Action.
I am controlling LFO value using one sensor and Cut-Off value through another sensor.
Note: In the video three sensors are visible, had used third one to play and pause the Record session.
I have tried to cover all the things with respect to the project, but if you need any help or have any queries regarding the project, I'll be more than happy to help you out.
Reach out to me in the comments or you can contact me through instagram (@suchdeep) or email (suchdeep95@gmail.com).