The project is done (Old 49 keys casio) to midi using Arduino MEGA

There is no steps

Do you understand what "Can you recheck your steps" mean? Please do say when you don't understand something I have told you to do, I have told you this before, my rule is third time and I walk away!

OK I have been doing some checking and somewhere along the line you changed

Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

into

Keypad kpd = Keypad( makeKeymap(48), rowPins, colPins, ROWS, COLS );

The variable keys is NOT a number, it is a pointer to an array.

However the big big problem now is that the Keypad library doesn't seem to return a released state, so while you can send MIDI note on, you can't trigger MIDI note off.

Try this code. I expect that for very short key presses you might get a note stuck on, and for longer presses you will just here a short note, but I want to test that the notes are in the right order.

#include <Keypad.h>

const byte ROWS = 6; //six rows
const byte COLS = 9; //nine columns
 
char keys[COLS][ROWS] = {
  {36, 45, 54, 63, 72, 81},
  {37, 46, 55, 64, 73, 82},
  {38, 47, 56, 65, 74, 83},
  {39, 48, 57, 66, 75, 84},
  {40, 49, 58, 67, 76, 85},
  {41, 50, 59, 68, 77, 86},
  {42, 51, 60, 69, 78, 87},
  {43, 52, 61, 70, 79, 88},
  {44}
};
 
byte rowPins[ROWS] = {26, 28, 30, 32, 34, 36}; //connect to the row pinouts of the kpd
byte colPins[COLS] = {A0, A1, A2, A3, A4, A5, A6, A7, A8}; //connect to the column pinouts of th

Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
int pressed = 32;
byte chanel = 0; // MIDI channel to use


void setup() {
 Serial.begin(115200); // set this the same as Hairless 
}

void loop() {
 // Fills kpd.key[49] array with up-to 10 active keys.
 // Returns true if there are ANY active keys.
 if (kpd.getKeys())
 {
   for (int i = 0; i < LIST_MAX; i++) // Scan the whole key list.
   {
     if ( kpd.key[i].stateChanged )   // Only find keys that have changed state.
     {  
       pressed = (kpd.key[i].kchar);            
       switch (kpd.key[i].kstate) {  // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
         case HOLD:
           sendMIDI(chanel | 0x80, pressed, 0);
           break;

         case PRESSED:
           sendMIDI(chanel | 0x90, pressed, 80);
           break;
         case RELEASED: // this never seems to trigger
            sendMIDI(chanel | 0x80, pressed, 0);
         break;
   
       }
     }
       
   }
 }
}  // End loop

void sendMIDI(byte type, byte note, byte velocity){
  Serial.write(type);
  Serial.write(note);
  Serial.write(velocity);
}