Click here to Skip to main content
15,900,378 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a MIDI controller with an X-Y touchpad that outputs values between 0 and 127. I want to write a program in C# that makes it act like a mouse. The resolution is too low to use absolute screen coordinates, so how would I go about using relative coordinates like a laptop touchpad?
Posted

You can do either or both of these
a. limit the area it controls to the range of values it can produce
b. scale the values i.e Mouse.X = (Screen.Width/128) * controller.X;

Many MIDI controllers can output two lots of 7 bit values to give 14 bit CC resolution - you also get a repeat of the status byte if running status isn't used, plus the paired controller byte. This would look something like

1sssssss (status)
0ccccccc (controller LSB)
0vvvvvvv (LSB value)
1sssssss (status if no running status)
0ccccccc (controller MSB)
0vvvvvvv (MSB value)


Your controller may possibly have a setting to enable this which would give you 0 - 16383 which would be plenty!
 
Share this answer
 
It can send pitchbend which uses 2 bytes so that's one axis sorted. Are there any more CCs that use 2 bytes that I can use?
 
Share this answer
 
They are all listed http://www.midi.org/techspecs/midimessages.php[^] in table 3.

Controllers 0 thru 31 are paired with controllers 32 thru 63 to give 14 bits. There are many that are 'Undefined' so it would be a good idea to use one or more of those.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900