There's a good video on there http://www.societyofrobots.com/robotforum/index.php?topic=12895.0to play the piano
you can either have a set of simple levers attached to a sliding rack (think of a printer head skipping back and forth)
you need a robot arm with many degrees of freedom and complex hands with fingers that can lock rigid as they press down hard on the keys
if you want to get the most out of velocity sensitive keys ,play notes loud or quiet you will need considerable strength and speed for accurate play. Mini servos wont be up for the task , you will need to play at least 4 if not 8 notes a second to make music. Fast passages approach 16 notes per second. Servos are not quick enough unless they have a long lever, which greatly reduces there strength.
Finger servos strong and fast enough to play properly would need to be held in place with a 10 kilo weight....for every action their is an equal and opposite reaction...a 10 kilo weight would need to rest in the wrist if the hand was held near level with the keys. (humans sit over and lean into the keyboard when playing, the weight and muscles in their arms keeping the fingers on the money)
cheap solution is attach at least 1 solenoid to a sliding rack that zips up and down the keyboard, that would be impressive to watch at speed
and perhaps importantly be a great demo for your talent and ability into the bargain....you might even go on a concert tour...and why not if its good enough ?
playing a keyboard is 3 dimensional.
1 dimension is the frequency of the musical note
1 dimension is the time spacing between the notes
1 dimension is how loud you play note (the faster the key is depressed the louder the note sounds & is true of real pianos as well as midi)
holding down a key (midi) or pressing damping or sustain pedals (real piano) are other actions that can be consider to be additional dimensionscheck on you tube for piano playing robots, i have seen half a dozen systems on there If you are serious
, i would strongly suggest writing a computer program that can play a virtual (software) midi keybaord. These virtual instruments can be dloaded for free. Once you have got your program playing music well , then you can start coding the hardware to do the job in the real world. Plunkety plunk wont be a particularly rewarding out come.
bet you are starting to wish you had never asked now
, that $50 robot is calling your name