Music Box Mechanism Simulator (2D)

This 2D simulator shows the working heart of a music box from the side: a pinned cylinder rotates past a fixed steel comb, each pin lifting and releasing one tuned tooth as it passes, while a ballerina figure spins in time with the crank the way a real mechanical automaton is geared to its cylinder. Every tooth's pitch is derived from its physical length using the same beam-frequency relationship as a real comb, so longer teeth ring low notes and shorter teeth ring high notes. Adjust the crank speed to change tempo and RPM, or swap the pin pattern to hear a different simplified melody plucked out note by note.