Molecular Music Box


Molecular Music Box is a music app that I wrote that creates algorithmic solo piano music.

I originally found this algorithm from a YouTube video by Professor Duncan Lockerby. In his video, he describes how you create music with "mix of music, maths, and molecular dynamics."

It's not easy to explain in text, but I will try. For the song 9 D 1 1/2, in the key of C, only the piano white notes (the naturals) are played. It may help to play the song using the music player here:

9 D 1 1/2, by Tom Snively, created by Molecular Music Box

A low D is played and held for 9 beats. You then play the next white key up, an E, and hold that for 9 beats. You continue up the white keys. While this is happening, you use a “loop pedal&rtquo; to record and repeat 4-measure loops. So, whatever sounded during the first 4 measures gets played again in the 5th measure while you add new notes. Each time you loop the 4 measures, there will be additional notes played.

You continue doing this until you are starting a new note at the same exact time an existing note is schedule to sound. In that case, you change from the initial length (9) to the secondary length (1 1/2), and play all the notes for 1 1/2 beats each until you again have a note already starting at that time. When that happens you switch back to the initial length (9 beats).

If you’d like to try Molecular Music Box, you can play or download Molecular Music Box below. The program has sliders for initial length and secondary length so you can make them go from 1/2 to 16, and the initial length can go from C2 (two octaves below middle C) to C4 (middle C). I also added three advanced features. You can adjust tempo from 60 to 300. I also added a “key” slider so you can have the song use any key instead of all white keys. I also allow you to change the loop length to go from 8 beats up to 32 beats.

My song 8 C 14 1/2 is in the key of Eb, giving it a natural minor sound. The loop length is 15, instead of an equal 4 measure 16. Listen here:

8 C 14 1/2, by Tom Snively, created by Molecular Music Box

I talk about this and more in episode 28 of the Making My Own Music podcast (which you can find now by searching for “Inside Video Game Music”).

Thank you to Mildon Studios for the beautiful piano samples.

Molecular Music Box screenshot



Browser (WebGL)

The WebGL version can be played here. This is a non-mobile browser version.


The Windows version can be downloaded here. Unzip (extract all) this file, and execute MatchEm.exe; no installation is required.

Mac (OSX)

The Mac (OSX) version can be downloaded here.


The Linux version can be downloaded here.