This was the tricky one!
I came in the project later when some of the modeling had been made. Unfortunately for me, the modeler had not kept an earlier version of it to make the rig conform to the shape of the bed, so I had to improvise!
I've made a universal "key rig", where you would basically duplicate it , then align (snap) 3 control points on the square ends of the keys or pedals. That would automatically be position the bone and controler in the right angle, ready to skin and sych to the melody!