As musical hacker mitxela explains, you can buy a music box that runs on punch tape fairly inexpensively, and if you’re really industrious you can even punch your own custom tunes note by note. This, of course, wasn’t good enough for him, and he set to work creating a system to transpose MIDI files into a pattern that could be cut out by his laser cutter. With this done, he no longer has to do the tedious work of punching these cards by hand, allowing him to auto-create musical punch strips up to 30cm long.
While this would be a worthy hack on its own, after the handle of his music box broke, rather than wait for the new one he ordered to come in (or just craft a new handle) he decided to enhance it into something better, a directly driven MIDI music box.
This took a serious bit of effort, involving 31 miniature hobby servos — one of them modded for continuous rotation — and an STM32F103 board for control. With hardware in place, along with a nice box, he now has a device that can directly play MIDI tunes, pushing pins forward to actuate the tabs that would normally be manipulated by punched paper.
Response time is so good that not only can mitxela play pre-programmed MIDI files, but it can also be used with a keyboard as shown around 7:50 in the video below. He explains how things work nicely there, and you can see an extended clip of it in action at 14:00, pleasantly plucking away.