I've been working my way through the search results of this forum, its how I reached the approach by @TAG
Split lines on top pcb:
Each section contains the same notes (octaves 1-7) and a duplicate of the matrix. When a note is hit, e.g. C4, it shouldn't matter which section it is from.
As well as only a smaller matrix to scan, there is the possibility of adjustable length to the keyboard by addition or removing sections. This doesn't affect the range of notes.
The Midi channel could be assigned based on rows, but not by section due to the repeated lines.