Need help decoding a 16 pin key matrix

I'm trying to convert a casio ctk-1500 keyboard into a basic midi keyboard with the Control Surface library, i thought id worked out the 16 pin key matrix as 9x7 but after soldering to a pi pico the outputs i get in synesthesia jump up in weird intervals.
I'm using a barely modified version of the default button matrix example sketch, and i soldered the matrix pins directly to gpio 1-16 after some trouble with using multiplexers but i cant wrap my head around the scan matrix issue. When tested with a multimeter, red on pin one and black on pin 16 shows a voltage when button 16 is pressed, then moving black to pin 15 button 7 gives a voltage. Any help on how columns/rows are identified would be appreciated

EDIT:
i tried an 8x8 matrix instead, im still having issues where sequentially button 1 presses midi note 24, button2= note 32 and so on but if i try swapping the column and row pins in code no keys function at all

 
#include <Control_Surface.h>
 
USBMIDI_Interface midi;
 
// The note numbers corresponding to the buttons in the matrix
//CHECK COLUMN ROWS
const AddressMatrix<8, 8> addresses {{
  {24, 25, 26, 27, 28, 29, 30, 31},
  {32, 33, 34, 35, 36, 37, 38, 39},
  {40, 41, 42, 43, 47, 45, 46, 47},
  {48, 49, 50, 51, 52, 53, 54, 55},
  {56, 57, 58, 59, 60, 61, 62, 63},
  {64, 65, 66, 67, 68, 69, 70, 71},
  {72, 73, 74, 75, 76, 77, 77, 78},
  {79, 80, 81, 82, 83, 84, 85, 86},
}};
 
NoteButtonMatrix<8, 8> buttonmatrix {
  {9, 10, 11, 12, 13, 14, 15, 16}, // row pins
  {1, 2, 3, 4, 5, 6, 7, 8},    // column pins
  addresses,    // address matrix
  Channel_1,    // channel and cable number
};
 
void setup() {
  Control_Surface.begin();
}
 
void loop() {
  Control_Surface.loop();
}

update

played around with the note layout, not entirely sure how i ended up with the right result but the casio ctk1500 matrix works with this layout

 
#include <Control_Surface.h>
 
USBMIDI_Interface midi;
 
// The note numbers corresponding to the buttons in the matrix
//CHECK COLUMN ROWS
const AddressMatrix<8, 8> addresses {{
  {24, 32, 40, 48, 56, 64, 72, 80},
  {25, 33, 41, 49, 57, 65, 73, 81},
  {26, 34, 42, 50, 58, 66, 74, 82},
  {27, 35, 43, 51, 59, 67, 75, 83},
  {28, 36, 44, 52, 60, 68, 76, 84},
  {29, 37, 45, 53, 61, 69, 77, 85},
  {30, 38, 46, 54, 62, 70, 78, 86},
  {31, 39, 47, 55, 63, 71, 79, 87},
}};
 
NoteButtonMatrix<8, 8> buttonmatrix {
  {9, 10, 11, 12, 13, 14, 15, 16}, // row pins
  {1, 2, 3, 4, 5, 6, 7, 8},    // column pins
  addresses,    // address matrix
  Channel_1,    // channel and cable number
};
 
void setup() {
  Control_Surface.begin();
}
 
void loop() {
  Control_Surface.loop();
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.