I can tell you right away that a string/motor system will prove entirely ineffective. If the mallet requires functionality, or at least any actual level of practical force, you will need to stay away from flexible parts and move towards either dynamic parts or a CAM. Either of these will work just fine. If you choose to implement a CAM, you will need to design a solid system in which bearings are placed around the main rotating shaft.
By a dynamic system, I infer something with two main positions/stages, or in other words, a linear actuator. Among these, a motorized linear actuator could work, or if you have the expertise and will, you may choose to attempt a pneumatic actuator. Automation direct sells some
good actuators.