Go Down

Topic: Sharp IR sensor to Midi cc message (Read 1 time) previous topic - next topic


Hello! :)  I'm very new to this Arduino community. Recently I am working on a project using a Sharp GP2Y0A21YK0F IR sensor and an Arduino nano to trigger midi message. What I am trying to do is to use the midi message generated by the distance proximity form IR sensor to control the virtual faders and knobs on the DAW. I use Cubase primarily. So basically the IR sensor is like a fader or knob on a traditional midi controller, and I want to map it to a setting of a virtual instrument or effect, such as "master volume", "wet", "resonance", etc... I am not looking for triggering a note-on message or something like that. I guess the Arduino should be output a continuous message. I am using this controller to do simple thing, for example, play a track on Cubase and control the track volume with the sensor. I wonder where should I start with the code? I'm more likely a musician rather than a programmer, so any advice or help would be greatly appreciated, thanks! :)


Nov 03, 2017, 09:49 pm Last Edit: Nov 03, 2017, 09:52 pm by DVDdoug
Assuming you already have an Arduino and the IR distance sensor, plug it into an analog input and run the Analog Read Serial Example to see if you're getting meaning/useful readings.   (You're not going to read the distance in any meaningful units but you should get bigger/smaller numbers related to the distance.)

...Later on, there is a map() function if you want to convert those numbers to useful MIDI values.

Then, there a couple of MIDI libraries for USB MIDI or regular serial MIDI.    Try sending some MIDI messages under pure-software control with no user-input.

Once you can read the sensor and write MIDI messages, you can write some code tying those together.

I guess the Arduino should be output a continuous message.
You probably only need to send the changes.

Go Up