# Mapping two encoders to navigate a grid

Hi!

I'm looking to create a tool which would take the output of two endless encoders as input and output MIDI notes that are arranged in a grid in such a way that I could use the two encoders and the MIDI messages they send to navigate the grid, triggering the different output messages. That is, one encoder would control the x coordinate of the note grid that is selected and the other the y axis. I would use this to select clips and in Resolume Arena, which has the clips that I want to preview laid out on a grid and only accepts midi notes for targeting them, but I would like to use two endless encoders on my Midi Fighter Twister.

I hope I managed to explain what I'm trying to accomplish.

Any advice would be greatly appreciated!

Hi, This is entirely possible.

Do you also want note off messages triggered for the last position when encoder moves to the new position?

The way you would set it up is that you would calculate the note number based on the previous note and the last moved position by the two encoders.

Say you have a 10x10 grid.

For every increase in the x position, you increase ga by 1. For every decrease, decrease ga by 1.

For every increase in the y position, you increase gb by 10. For every decrease, decrease gb by 10.

In both cases set up rules like this to ensure you never go out of bounds

if ga>100 then ga=100

if ga<0 then ga=0

Both translators trigger a timer (say "note timer") that multiplies ga by gb and sends the note. Probably put a delay of 100ms or so

------
Translator : Send note off last and note on calculated
Incoming: Timer "note timer"
-------
// get last note sent so you can turn it off

pp=gc

// Calculate note

qq=ga*gb

//set midi channel 0=MIDI channel 1 For midi channel 2 change to 1 etc

rr=0

// Set up for note on

tt=0x90|rr

// Set for note ff

uu=0x80|rr

// uu gg 00 is note off on last note gc

// tt qq 7f is note-off current calculated note at full velocity

-------
Outgoing: Raw MIDI uu gc 00 tt qq 7f
Options: Swallow
------