Press "Enter" to skip to content

Phil Burk’s Look Back Melody Algorithm

First of all, I probably shouldn’t attribute this algorithm to Phil Burk. I imagine that many people have implemented a version of this algorithm. It’s a simple, almost fundamental musical algorithm, but he is the first person who brought it to my attention, so for the time being, I will call it Phil Burk’s Look Back Algorithm.

In pseudocode, the algorithm looks like this:


1. Generate a handful of random note events (pitch, duration, velocity)
2. For each successive note in the piece, notes[i] = notes[i - delay] + transposition
3. Occasionally insert a random note event
Where notes is an array of note events, notes[i] represents the current event, delay represents how far to look back, and transposition is a transformation of the previous notes.

Phil brought up this algorithm in reference to a hyper-simplistic fugue generator. Essentially all it does is repeat sections of music that have already been generated. It pulls subsets of earlier note events and subtly transforms them. It infinitely noodles around on whatever random note events are generated in the first place.

The algorithm is remarkably effective for its simplicity. It is an elegant way of generating really coherent melodies. Here is a simple melody I generated using this algorithm: LookBackOutput.mid

And here is a simple Eclipse project that implements the Look Back algorithm in java and outputs midi files.

Be First to Comment

Leave a Reply