Annoying Sound Delay Bug
Usually when I run the program, there is a delay before the sound is heard. There seems to be a bug in the Java MIDI software, or perhaps it is a problem with how my browser (Firefox) handles MIDI. Try quitting the browser entirely and starting it up again. That always works for me. (Annoying, I know). I'll try to find out how to solve this problem.

See it on YouTube

Melody Ball is now OpenSource...
Click here to contribute

What's Melody Ball?
Melody Ball is a ball that bounces along a set of sound-making pieces, like the bars of a xylophone. All you need is gravity, and the right configuration of xylophone pieces. These pieces are arranged perfectly so that a melody plays as the ball bounces along. The inspiration originally came from watching kinetic ball sculptures displayed in public places, such as those created by George Rhoades. The idea for the Melody Ball algorithm was born out of several conversations between myself and Eddie Elliot.

How It Works
Imagine taking apart a xylophone and placing the pieces in different positions and at different angles. If you've ever played a pinball game, you've seen how a variety of surfaces make the ball bounce in lots of interesting and fun ways. What if you could arrange xylophone pieces inside a pinball game so that when you drop a ball onto the top piece, it bounces and lands on all the other pieces in the right order, and plays a melody!

But here's the problem. In the REAL WORLD, it would be almost impossible to get the ball to land on each piece just right for every bounce. If anything went slightly wrong for one of the bounces, it could get thrown off-course, and the entire melody would fall apart from that moment on. This is one of the basic concepts in chaos theory: sensitivity to initial conditions.

To see exactly how sensitive it is, try grabbing the ball while it's playing the melody, and then dropping it on a xylophone piece. You will never be able to get the melody to pickup exactly where it left off - unless you could toss it at the EXACT right position and velocity that it was when you grabbed it. Try it!

All Go Rhythm
But how did I figure out how to arrange the xylophone pieces? It's not as straightforward as one may think at first. Because, just like in the real world, the position and angle of any piece responsible for one of the musical notes MUST take into account the position and angle of the piece responsible for the previous musical note. And so on. This means that the pieces have to be arranged (and tested) one-by-one. The algorithm uses repeated trial-and-error to figure out the right location and angle of pieces, so the ball always hits the right piece, and never accidently hits a wrong piece.

What you can see now is the result of this algortihm which came up with a set of xylophone pieces placed so that the melody plays correctly, without missing a beat.

Ideas for a More Interactive Version
Well, if this is like most software toys you can find on my web site,, it'll just sit there in its current state and I'll never get around to making it do what I REALLY want! In this case, my ultimate goal would be to have an interface where you can input your own melody (either by hand or by way of a MIDI file that you upload) and the program will find the right arrangement for you to drop the ball and enjoy your own music. Now that it has been made Open Source (thanks to the help of Tom Barbalet), maybe some clever hackers out there can contribute, and take in a new direction.

JJ Ventrella

created by Jeffrey Ventrella