Build with this node

Start with a prompt in Studio, or copy it into your own coding agent.

Ask Studio

@maruaudio/dsp/math/grid-coordinates maps a controller key index to a row and column on either a square 8 × 8 grid (64 keys) or the 61-key hex layout of the Exquis, whose rows alternate six and five keys (HEX_ROWS = 11). For hex, axialColumn converts an offset column to an axial one by subtracting floor(row / 2). All arithmetic is integer Math.floor, % and comparisons.

Functions

NameInputsOutputDomain as coded
positionKeyRowkey, hexrow index, or −1Square: floor(key / 8) for 0..63. Hex: floor(key / 11) × 2, plus 1 when key % 11 >= 6, for 0..60. A negative, out-of-range or fractional key returns −1
positionKeyColumnkey, hexcolumn index, or −1−1 whenever the row is −1. Square: key % 8. Hex: key % 11, minus 6 on the five-key row
axialColumncolumn, row, hexcolumnHex: column - floor(row / 2). Square: column unchanged. No validation
HEX_ROWSconstant11

Lifecycle

None. Stateless functions with no preparation or instance state.

When to use it

Compiled controller Processors that turn a pad press into a position on an isomorphic note layout. The Isomorphic Keyboard and Exquis Controller modules share it (shared behavior).

Limits

  • Two fixed layouts only; the key count (61 or 64) is coded, not configurable.
  • Packaged faces do not import DSP. The face keeps its own coordinate projection, which is checked against this DSP node.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Dependencies

None: this node imports no other node.

Dependents

No other node imports this one.

Used by