Some Things About Springs

How Anukari turns bouncing masses into music. Every diagram on this page is a live physics simulation. Drag it, strike it, play it.

what does "spring-mass" even mean?

"Spring-mass simulation" is just a fancy term meaning that we made a computer try to guess what would happen if you glued a spring to a small ball, hung the spring somewhere, pulled back the ball, and let go.

If you're like me, you've taken apart your clicky ballpoint pen, found a spring inside, and accidentally launched it across the room while your boss was saying something important. It's that kind of spring. It has a certain length it likes, and if you stretch it, it pulls back towards its favorite length. If you squeeze it, it pushes back. When it's at its happy length, it just sits there.

Why do we glue a ball to the spring? Well, when you stretch and release a tight spring, it returns to its happy length pretty quickly. The ball (the "mass") is there to slow it down. Since the spring has to push and pull something heavy, it goes slower.

To the side of each explanation on this page (or below, on mobile), there's an interactive diagram with some springs and masses. These are actual spring-mass simulations, like Anukari, only simpler. You can play with all of them using your mouse or touchscreen.

→ For this diagram, try dragging the mass up or down and see what happens! The orange arrow shows which direction the spring is pulling or pushing, and how hard.

How does it make sound?

You probably noticed in the simulation above, when you let go of the mass, the spring didn't instantly return to its happy length. It bounced around. It kept overshooting its happy place, and alternated between pulling and pushing. In other words, it vibrated.

Sound is simply a vibration that happens fast enough. If something vibrates back and forth faster than about 20 times per second, it starts to sound like a pitch. The faster it vibrates, the higher the pitch.

In the real world, a vibrating spring is bumping against air molecules, which then bump into each other, and ultimately bump into your ear, and that's how you hear it.

To keep things simple, Anukari does not try to simulate the air molecules. Instead, to make sound, it watches the movement of a mass and directly turns that into an audio wave.

→ In this diagram, you can drag the mass up or down. Make sure your volume is up so that you can hear the sound it makes! Watch how the movement of the mass is turned into an audio wave. Turn on the slow-motion feature to see the wave more clearly.

What makes it stop?

In the simulations above, the vibration did not continue forever. It gradually slowed down and stopped.

When you squeeze or stretch a spring, you are putting energy into it. In a way, a spring stores energy like a battery. Consider a pop-up toaster: when you push the lever down, you are squeezing a spring. That stores a bit of energy in it. Later when the lever is released, the energy in that spring pushes the toast back up.

When a spring is allowed to freely vibrate, the energy stored in it gets lost over time. Some of the energy is lost because it is transferred to air molecules. A little bit of the energy turns into heat; bending the spring metal warms it up. Eventually all of the stretch/squeeze energy is lost and the spring comes to rest.

Anukari lumps all of these energy losses into a single number called "damping." A higher damping means energy is lost more quickly.

→ In this diagram, when you drag and release the mass, you'll notice that it comes to rest much more quickly. There's a slider below that lets you adjust the damping.

Try different values and see what happens when you drag the mouse again. If you enable slow motion, the vibration will continue long enough for you to edit the damping while the spring is vibrating.

What controls the pitch?

Different springs can be easier or harder to stretch or squeeze. The strength with which a spring tries to return to its happy length is called its "stiffness."

That ballpoint pen spring is pretty stiff (that's why it will shoot across the room). But if you've ever played with a Slinky, that's an example of a loose spring. It kind of wants to return to its happy length, but it is not trying very hard.

Because a stiffer spring pushes and pulls harder when trying to return to its happy length, it will vibrate more quickly. Because it vibrates more quickly, you will perceive it as having a higher pitch. So increasing the spring's stiffness increases its pitch.

But we can't forget that there's a ball glued to the end of the spring! If the ball is very heavy, it will slow down the spring's vibration, because the spring has to do more work to speed it up and slow it down as it vibrates. This heaviness we call "mass". Larger mass means slower vibration.

→ In this diagram, once you set the spring in motion, try changing the stiffness and mass sliders, and hear what happens. Figure out how to get the highest pitch, and the lowest pitch.

weirder sounds please

Now that we can control how long a spring vibrates, and also the pitch it will make, we have the basic ingredients for making music.

But the sounds so far, while pleasant, are very simple. Obviously we'd like to make some more interesting sounds.

A common misconception about Anukari is that the masses (the balls) are "made from" metal, and that changing them to be made from something else, like wood, would change the sound. (I mean, I definitely made them look like metal, so this is completely understandable.)

But the reality is that the masses are not "made from" anything. They are much more like the atoms that things are made out of. So far the simulations have only had one mass, so it's like we're listening to a single atom vibrate.

Real-life objects are made from gazillions of atoms. So maybe to get more interesting sounds, we should try to add more atoms.

→ This diagram takes a baby step in that direction: what happens if we simply add one more mass to our system? You can drag either mass, and you can also adjust how heavy they are with the sliders below. Experiment and see what it sounds like!

Into two dimensions

So far all the simulations you've played with are one-dimensional: all the vibrations were along a vertical line. There was no horizontal motion.

It turns out that another way to make the sound more interesting is to add another dimension, and let things move horizontally as well.

→ This diagram doesn't make sound, but should give you a feel for what a spring-mass system does if you let it flail about in two-dimensional space. You can drag the free mass, and you can also drag the fixed anchors around as well.

(The real Anukari is in three-dimensional space, so imagine even more wiggling chaos!)

combining several springs

At this point it's worth talking about what happens when there is more than one spring glued to a single mass. Anukari lets you connect as many springs as you want, but for now let's just look at two springs.

When you drag around the mass, each spring will have been moved a different amount from its happy length. The springs will push or pull different amounts, and now that we're in 2D, the springs can push or pull in different directions, too.

I like to think about the springs sort of like a game of tug-of-war. Both sides can be pulling really hard, but there still might not be a lot of movement if the pulling "cancels out."

In the case of springs, some of their forces on the mass may cancel out, or in other cases they might pull/push in a similar direction and add together. Mathematically what's happening is that we are taking the sum of all the forces to get a "net force."

→ In this diagram, the pink arrows show the push/pull forces from each spring on the mass, and the orange arrow shows the combined, or "net" force. Using slow motion, you may notice that the mass is constantly trying to move in the direction of the orange arrow.

introducing Microphones

In the simple 1D systems above, we made sound by just watching a spring's movement along the vertical line, because that was the only dimension along which movement could occur.

A single channel of an audio signal is inherently 1D. But now that we're in 2D, there are infinitely many 1D lines we could choose. It's no longer just up and down: we could pick a horizontal line, or a line at any angle we like!

The choice of which line we use to measure the vibration has an effect on the sound that we'll get. Imagine measuring vibration on a horizontal line, when the spring only vibrates vertically. This wouldn't produce any sound at all.

So we need a way to choose what direction we will measure vibration on. Anukari does this via virtual microphones. The direction along which vibration is measured is the line between the microphone and the mass it is connected to.

→ In this diagram, make some noise by dragging the mass, and then hear what happens if you drag the microphone around.

Exciters: the mallet

So far to get noise in the simulations, you've had to drag a mass around and release it. That's how you introduced energy into the system to hear it vibrate.

If we want to be able to play the system as a synthesizer with a MIDI keyboard, though, we will need some other way of introducing energy. In Anukari, we call this an "exciter."

The simplest exciter is the mallet. If you think about what a real mallet, or hammer does, it basically just pushes on something for a short duration. In the case of a hammer, it might push quite hard for a little while, and that's how it can drive a nail into wood. The mallet for a small xylophone does the same thing, but it pushes much more softly, so it wouldn't drive a nail in. It might just introduce a little bit of energy. That's what we need!

→ In this diagram, tap the "Strike" button a few times to get a feel for it. Note that the mallet is a bit more abstract than a real hammer: it doesn't have to actually contact the mass. It just represents "applying a brief push in a specific direction."

Striking the full system

Let's combine everything we understand so far: springs, masses, microphones, and mallets, into one system.

Mallets have a number of parameters that we can adjust. The two that we will simulate here are "hardness" and "noise."

In the diagram, the yellow line at the top is a graph showing how hard the mallet will push against the mass it is connected to, over a brief duration. You can see that when the mallet is struck, the force it applies starts out small, smoothly grows to a maximum, and then smoothly dies back down.

If you adjust the hardness parameter, you can see that a harder mallet imparts all the force in a shorter duration. A softer mallet applies the force over a longer duration.

The noise parameter introduces some randomness into the force curve.

→ Both of these affect what happens to the mass when the mallet strikes it. Play around a bit with both parameters and press the "Strike" button to hear what happens.

Playing pitches: time dilation

We are very close to a working synthesizer. The biggest missing piece at the moment is being able to play different pitches. We know that adjusting mass and stiffness can change the pitch, but we'd prefer not to have to do that for every note we want to play.

Anukari has a way to automatically change the pitch of the system for a given musical note, so that playing different notes produces different pitches. I call what it does "time dilation." That's a fancy term for "it changes the speed at which time passes in the simulation."

One nice thing about simulating reality is that we don't have to play by the rules if we don't want to. In real life, we can't change how fast time passes. In a simulation, we can.

Faster vibrations produce higher pitch, right? So if we make time in the simulation go faster, we will get a higher pitch. It turns out that to raise the pitch one octave, you need to double the speed of the vibration. So, we double the speed of time.

→ This diagram lets you tap notes on a keyboard to play it. (If you have a MIDI keyboard attached to your computer, you can use that too!)

Based on which note you play, the simulation figures out how fast time needs to go to make the pitch higher or lower. If you watch carefully, you will see that the clock moves more slowly when you play the lowest note, and moves more quickly when you play the highest note.

Polyphony: voice instances

So we have built a working monophonic synthesizer. If you've made it this far, congrats, you are a seriously curious person!

Monophonic just means that the instrument can only play a single note at a time. But of course we'd love to be able to play more than one note at a time, to play chords: we want to make the simulation polyphonic.

How do we do that, though? To get the right pitch, we are changing the rate at which time passes. The universe has only one time dimension, so how could we get two pitches at once?

Obviously we just need to create more universes!

In Anukari, each independent note you play is achieved by running an entire separate simulation, which I like to call a "pocket universe." Time in that specific pocket universe is set to run at the right speed for the note assigned to it. All the pocket universes are simulated at once, and their audio output is combined to get the final sound.

The payoff to all of this is that now we have transcended diagrams: this one is actually a very simple spring-mass synthesizer. The baby sister of Anukari, if you will.

→ Play it by tapping notes, or using your QWERTY keyboard, or even your real MIDI keyboard. There are four pocket universes, and you can see the audio signal coming out of each one.

Notice that if you repeat the same note, it will reuse the same pocket universe. But if you play different notes, it will "steal" the pocket universe that was least recently used to play a note. Since there are four pocket universes, you can play four notes at a time.

Appendix a: 2D nonlinear pitch bending

(Note, for the appendices I am going to use a bit more technical language.)

From time to time, I'll have a mathematically-inclined user write in about what seems like a paradox. They point out that the spring equation f=-kx is linear, and a spring-mass system has a known resonant frequency, its "natural" frequency. But they hear an example of an Anukari patch, and notice that even simple presets often have variations in their pitch that should not be possible with a linear system.

For a spring-mass system in one dimension, they would be correct that this is not possible.

However, Anukari is a three-dimensional simulation, and what's interesting is that this throws linearity out the window, which allows for all kinds of weird sounds that one-dimensional systems cannot make. (In fact, even a two-dimensional spring-mass system is no longer linear.)

To understand why adding a dimension changes things, take a look at the diagram on the right. Notice that when the system is at rest, the springs are opposed along the same horizontal axis.

→ Now, pull the mass upwards, along the vertical axis, and release it. It is subtle, but you should be able to hear that the pitch starts higher, and drops a little bit as the vibration damps down. That pitch change is the nonlinear thing we're talking about.

What's happening here? Imagine that you pull the mass perfectly upwards. The system will be symmetrical about the Y axis. That means that the X component of the two identical springs' forces will perfectly cancel out, leaving only the Y components.

What's interesting is that due to the geometry of the system, the Y component of the spring's force is proportional to the sine of the spring's angle. When the spring is perfectly horizontal, there's no Y force at all. When the spring is at a 45 degree angle, half of the spring force is along the Y axis.

Thus the vertical force acting on the body from one spring is not f=-kx, but is rather f=-sin(θ)kx. Bye bye linearity!

Intuitively, in this setup, when the mass is further from equilibrium, the springs are at a larger angle, and thus the force is higher. So when the system is vibrating with more energy, the pitch is higher because the peak forces are higher. And as the system damps down to lower energy states, the angles are smaller, and the pitch drops.

Appendix b: Stereo output

For simplicity, all the examples above have mono output: the same audio signal is duplicated in the left and right channels.

This is fine for the demos, but for a real audio product we need to have stereo output. And ideally we'd like to support formats with more than just two channels.

In real life, microphones are monophonic: they pick up a single channel of sound by measuring changes in air pressure at a single place in space. So in real life if you want to record stereo audio, you need two mics. Often the two mics are oriented so that they are at an angle to one another, or are spread apart in space, so that, like our two ears, they pick up two slightly different recordings.

Similarly for a spring-mass synthesizer, we can get stereo output by creating two mics, and adjusting their orientation and position to achieve the desired effect.

→ In this diagram there are two microphones, and each one shows its individual audio wave. If you’re wearing headphones, or have good speakers, when you move the two mics around in the simulation you will hear how the left and right channels change independently.

For multichannel support (more than two audio channels), we simply create more mics and route them to the other output channels.

stay in-the-know

SUBSCRIBED!
Oops! Something went wrong.
© 2026 Anukari LLC