Posted By

stefangoodchild on 02/10/10


Versions (?)

Novation Launchpad – Note number to XY Coordinates and back again.

 / Published in: Java

First thing I did with my new Launchpad? Nope, I didn’t hook it up to Live and jam. I hooked it up, fired up Processing and worked out how to light up the pads and recieve the notes so I could hack it to do anything I wanted to.

One thing I noticed straight off the bat is the note numbers are not incremental. Each row starts 16 higher than the last - I assume to allow for the same firmware to work in a 16 x 16 layout model - and there is a very simple way that reminds me of the technique of bitshifting I used back in the bad old days of DVD authoring to convert from one to the other.

  1. // To go from XY to the note number
  2. noteNumber = y * 16 + x;
  4. // To go from the note number to the XY
  5. x = noteNumber % 16;
  6. y = (noteNumber - x) / 16;

Report this snippet  

You need to login to post a comment.