Simulating the physics behind a music box

Here’s what the simulated sound of a music box sounds like:

Some background

The comb teeth [3] in the picture below are the ones responsible for the notes you can hear.

Music box [wikipedia]

The ratchet lever [1] rotates the cylinder [2], the pins pluck the comb teeth [3] which produces the music. The whole thing rests on the bedplate [4]. Source: wikipedia

Version 1

The first model I made consisted of a uniform thin metallic plate (see the really cool gif below!). Problematically, there’s some really strong coupling between the pins. Here’s what happens when you apply a static deflection to one of the pins and let it go:

FEM model of a music box

FEM model of a music box with a uniform plate thickness. Note the coupling of the pins.

As you can see, the adjacent pins start to vibrate after some time. The resulting tone is decent, but it’s a bit “wobbly” due to the coupling between the pins:

Version 2

The problem with the coupled pins must be something that would happen with real music boxes as well. Well then, how has this problem been solved before? What I noticed was that the thickness of the plate seems to vary. OK, so let’s double the thickness of the plate everywhere except at the pins. Additionally, let’s move the stiff supports a bit closer to the pins. Combined, these actions decrease the amount of sound that travels from one pin to another significantly. So, in practice, we get a tone that is a lot clearer. Great! After some minor additional changes, this results in the sound you can hear in the example at the very beginning of the post. There’s still some coupling between some of the pins, but it’s small enough not to be bothersome.

Refined music box model

Refined music box FEM model. Note the absence of the strong coupling present in the previous model.

Some theory

I used the Mindlin–Reissner plate theory, which should quite accurately describe the vibrating thin plate that causes the sound. I solved the problem numerically using finite element analysis using my own solver in python.

I started by calculating the static deflection of each pin when a force is applied at the very tip. I then “released” the pin, and calculated the resulting deformation in small time increments for each pin (using the GN22 algorithm). Then, I calculated the average position, velocity and acceleration of the plate at each time frame; if the whole plate is simplified and considered as a single mass with one degree of freedom the forces the plate directs at surrounding structures (such as a table, which I assume radiates most of the sound caused by the box to simplify things) should be somewhat proportional to the average acceleration of the plate.

The frequencies the pins vibrate at can be calculated according to the formula for the lowest natural frequency of a cantilever beam:

$$\frac{3.52}{2\pi L^2}\sqrt{\frac{EI}{m}}$$

where L is the length of the pin, E is the elastic modulus of the material, I is the moment of inertia and m is the mass per unit length. If $$L_0$$ is the length of the longest pin, we can now get the lengths of each subsequent pin using $$\frac{L_0}{\sqrt{2^{i/12}}}$$, where $$i$$ is how many semitones higher we wish to tune the pin to.

Some thoughts

I’m really happy with the result, it sounds almost as good as the real thing. I added a bit of reverb, which is quite important for a natural sound. I think this is as far as I’ll go with my music box simulations, but we’ll see. 🙂

3 thoughts on “Simulating the physics behind a music box

  1. Titania

    I’ve gotta say, phenomenal work.

    I’m trying to make a physical music box myself (as a sort of wedding present), and I really need it to be perfect. I’ve seen a lot of good videos about people making them, but in the end they always sound… off. Like, I can understand that they are amateurs (as am I), but the go to answer to “how should I expect to tune my comb?” is “I dunno, just keep trying to make one until it comes out right,” which is a very unsatisfying answer.

    I’m the “measure twice, cut once” kinda person, so I don’t like going into things without a perfect plan; like I need to know what kind of length to expect, how much weight to add to the tines for the right tone, what material the comb should be made of… that sorta stuff. (Plus, I don’t have the kind of money to throw around on buying a bunch of different plates just to find the one I want.)

    This has been the one thing I’ve found so far that gives me an idea on where to go next; I’m gonna start window shopping for some metal plates and drumming up some calculations of my own to see how long I want the comb to be (or at least determine the bounds I can expect to build in).

    So thanks a lot!

    Also, a quick question, if you ever do get around to seeing this: you mention length of the pin in your equation, but the two sides of the pins are ever so slightly different. Did you use a particular side when choosing the length, or did you take the average length of the two sides? (Or perhaps you used some different method I can’t think of; if so, I’d be excited to find out).
    I’d like to know since it could influence how deep I need to cut. (Granted, the difference would be small, but at this scale, that still means a lot!)

    1. Kai Post author

      Hey! Sorry, very seldom check the comments here. Thanks for reaching out!

      Very good question, intuitively I would expect it to be enough to consider the “shorter distance” of the sides. Assuming the pin vibrates mostly perpendicular to the plane / we ignore rotational modes 🙂 Would be quite straightforward to validate with the simulations… But not going to simulate this now, though, hopefully I’m right.

      Note also that it’s important that the plate isn’t the same thickness! Would need to have a thicker base to avoid the nasty coupling you can hear here.

      Feel free to reach out if you wish, happy to hear more about the project if you want to share.

      1. Titania

        No worries; I saw that this was posted in 2015, so I didn’t get my hopes up. If anything, I’m surprised you responded at all.

        I’ll probably reach out to you directly some time later; partly because it’s just a fun project to talk about, and partly because, if I’m updating someone on my progress, maybe I’ll be able to push past some roadblocks instead of letting them get in my way.

        Look forward to talking to you soon.


Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.