Rhythm Blending (Experiments in Computational Music)

November 2015
Take a look at the shape below. It will change if you move your mouse from one side of the browser window to the other.
As you move your mouse from side to side, the shape drifts from one form to another. What's happening is that each vertex in the shape is moved along a linear path. We call this linear interpolation. Linear interpolation is widely used in computer graphics for constructing animations.
I wanted to see how I could use linear interpolation to create music. Rhythms are a good place to start. Rhythms, like shapes, can be defined as a collection of points, which are drawn as blue dots.
Specifically, let's talk about percussive rhythms such as those created by a snare drum or a bass drum. Though we think of a note made by a piano as having a duration, the hit of a snare drum is almost instanteous. It's not exactly instantaneous. Of course it has some duration. But we can think of it as instanteous. This is the analogy between percussive notes and points. Percussive notes have no extension in time (they're instantaneous), and points have no extension in space.
So below there is a randomly-generated rhythm drawn as a series of blue dots, or points. If you press on the canvas, the rhythm will play and animate. If you press it again, playback will stop.
Using the same process of linear interpolation from the first example, we can change the form of the rhythm. In the example below, moving the mouse cursor left and right modifies the rhythm. Again: press on the canvas to toggle playback.
Things become more musically interesting when we have two rhythms play at the same time, as in the example below. Try to notice how they move in the same way but in opposite directions. Try also to notice how the two rhythms meet in the middle: if you put your mouse cursor in the middle of the browser, the rhythms will be in sync with each other.
We can automate the process of blending between rhythms. press the example below and see how they change form gradually.
In the next example, they change form in discrete steps. This makes it so the rhythms always have clean, rational relationships to one another.

Some Extra Examples

Another couple of rhythms you can control with your mouse:
Those same rhythms---but made to change automatically:
An example with randomly-generated rhythms:

Possible Uses

So what actual applications are there of this idea? What can one do with it?

One possible use is in the form of the compound rhythms that I've been showing, the examples which have two rhythms playing simultaneously.

Another possible use of the idea is as a way of transitioning between different sections of a song gradually rather than suddenly.

Future Work

Though I've focused on percussive rhythms, there's nothing stopping this idea from being applied to non-percussive rhythms, rhythms involving sustained notes. I've focused on percussive rhythms because its easy to model them as sets of points. But non-percussive rhythms could be modeled as sets of lines and subjected to the same blending procedures.