The very first use of robotics was for that purpose. The finest "piano playing robots" were perfected and all standardized 110 years ago in 1908, and nothing much in the way of improvement has been accomplished on them since.
In fact, it could be argued, that the whole rest of the history of IT and robots grew out of the invention of these late Victorian piano playing robots.
Except they weren't called "piano playing robots". They were, and still are, just called "player pianos".
When I tried to learn programming in the Seventies we used stacks of hollerith cards. Those cards with little square holes punched in them ( do not fold spindle or mutilate). Hollerith cards are just a small version of the "piano rolls" fed into player pianos.