Hacking the keyboard of m-audio axiom 32
I love this keyboard because of the size/octaves and how it feels when being played
VC = Velocity column (its used to determine velocity)
This is how the developers mapped the keys in columns/rows on the flex cable (in order):
R1, R2, R3, R4, R5, R6, R7, R8, C1, VC1, VC2, C2, C3, VC3, C4, VC4
There are two keys placed differently on the PCB underneath every piano key/note. One is slightly higher and located above the other. So the velocity can be determined by counting the time between the keypress on the above one and the lower one. When I tested this and timed the keypresses I measured with the millis() function in Arduino it never went above 1000, usually it stayed between 1 to 600.
In my key matrix I decided to map the velocity columns to numbers 100, which makes it easy to determine if its a “velocity key” or “note key” being pressed. If the key pressed is above 100 just start the millis() timer.
The timing later needs to be mapped >logarithmically< into velocity MIDI data (1-127).
This is how I mapped it:
uint8_t velocity = log(elapsed+1)/log(600)*127;
velocity=map(velocity, 1, 127, 127, 1);