It has been over two years since the Infinite Jukebox was first released after Music Hack Day Boston 2012. Since then millions of people have spent nearly a million hours listening to infinite versions of their favorite songs. It has been my most popular hack.

There has always been a problem with the Infinite Jukebox. Certain songs have sections with very dense interconnections. For these songs the Infinite Jukebox would sometimes get stuck playing the same section of the song for many minutes or hours before breaking free. This morning I finally sat down and worked out a good way to deal with this problem. The Infinite Jukebox will now try to steer the song toward the beats that have been played the least. When the jukebox is deciding which beat to play next, it will search through all the possible future paths up to five beats into the future to find the path that brings the jukebox to the least played part of the song. The result is that we exit out of the rats nest of connections rather quickly. The code is quite succinct – just 20 lines in one recursive function. Good payback for such a small amount of code.

While I was in the codebase, I made a few other minor changes. I switched around the color palettes to favor more green and blue colors, and I use a different color to draw the beat connections when we make a jump.