You can use ST7 micros with SCI - Serial communication Interface (e.g. devices like ST72F264 or ST72F521). The SCI can be interfaced to create MIDI interface and I/Os can be programmed as your Piano keys.
I have tried with the SPI protocol with a st7lite09, as you can find in my other question, but after a byte trasmission i have 5 volt fixed at pin 3 of the port B (used for the SPI trasmission in master mode). I should have 0 volt. I have tried in several ways, but i couldn't find the way to reset the pin 3 of the port B. Something is wrong? Have you a solution? I thank you