Arduino midi drums control velocity sensitivity

dear i have made Arduino midi drums controller. it is running well but i wanna make it most velocity sensitive. hope you can help me.

unsigned char PadNote[8] = {36,38,42,46,43,47,48,49}; // MIDI notes from 0 to 127 (Mid C = 60)

int PadCutOff[8] = {500,500,500,500,500,500,500,500}; // Minimum Analog value to cause a drum hit

int MaxPlayTime[8] = {40,40,40,40,40,40,40,40}; // Cycles before a 2nd hit is allowed

#define midichannel 0; // MIDI channel from 0 to 15 (+1 in "real world")

boolean VelocityFlag = true; // Velocity ON (true) or OFF (false)

boolean activePad[8] = {0,0,0,0,0,0,0,0}; // Array of flags of pad currently playing
int PinPlayTime[8] = {0,0,0,0,0,0,0,0}; // Counter since pad started to play

unsigned char status;

int pin = 0;
int hitavg = 0;

#define NumPads 8
void setup()
{
Serial.begin(57600); // connect to the serial port 115200
}

void loop()
{
for(int pin=0; pin < NumPads; pin++)
{
hitavg = analogRead(pin); // read the input pin

if((hitavg > PadCutOff[pin]))
{
if((activePad[pin] == false))
{
if(VelocityFlag == true)
{
// hitavg = 127 / ((1023 - PadCutOff[pin]) / (hitavg - PadCutOff[pin])); // With full range (Too sensitive ?)
hitavg = (hitavg / 8) -1 ; // Upper range
}
else
{
hitavg = 127;
}

MIDI_TX(144,PadNote[pin],hitavg);
PinPlayTime[pin] = 0;
activePad[pin] = true;
}
else
{
PinPlayTime[pin] = PinPlayTime[pin] + 1;
}
}
else if((activePad[pin] == true))
{
PinPlayTime[pin] = PinPlayTime[pin] + 1;

if(PinPlayTime[pin] > MaxPlayTime[pin])
{
activePad[pin] = false;
MIDI_TX(128,PadNote[pin],127);
}
}
}
}

void MIDI_TX(unsigned char MESSAGE, unsigned char PITCH, unsigned char VELOCITY)
{
status = MESSAGE + midichannel;
Serial.write(status);
Serial.write(PITCH);
Serial.write(VELOCITY);
}

DrumKitV1b.ino (4.79 KB)

hitavg = ((hitavg*31)>>7)-121