# Marathon: Understanding Ratio Morphing

I’ve already written a bunch of posts on microrhythms and have since created a little free program to help create microrhythm in MIDI files. Now, I want to try and give a better explanation on how morphing works.

Morphing occurs when you put two rhythms in opposition. Let’s take the fairly easy example of the traditional Gnawa three-note rhythm. The two conflicting rhythms here are the straight triplet and a quintuplet feel “swing” version of itself. This conflict is made abundantly clear by Malcolm Braff’s conception of it. Triplet notes (below) conflicting with a quintuplet swing version of itself (above). Source: Malcolm Braff

Now, I’ve transposed this visualisation onto Excel in order to add a few details and use the formula for other rhythms as well.

What you can see in the latter image is the straight triplet rhythm at the top, meeting with the 0 % morph value. At the bottom, 100 % morph, you get the quintuplet-feel pattern of the original three notes. You can imagine it playing in your head by following the line from left to right at a steady pace and, every time you cross a line, you strike a note, counting the starting point. In the Gnawa tradition, the pattern is “long-short-long”, but you can make any number of different rhythm patterns, such as “short-long-long” or “long-short-short”, if you wish to depart from that style. Each of these choices will yield a different graph, however. At the top of the image, you see gridlines coming down and disappearing. They represent the triplet grid of a measure. They disappear because, as morph increases, you feel less and less the triplet feel and more and more the quintuplet one, where new gridlines appear near the bottom. In the middle area, you can get many different feels, depending on the morph value and the different ratios given. Before delving more in this, let me show you a small table. In the left column, the morph value of the Gnawa rhythm, and on the right the resulting ratio between its resulting notes.

It might look like just another way of presenting the same data, but we can more clearly get specific information under this format. The data is arranged the same way as in the previous graph, with the morph values going from 0 to 1 (the same as 0 % to 100 %) and each note’s length being displayed, here numerically instead of visually. On top, you get the 1:1:1 ratio, which means that the three notes are of equal length, and, at the bottom, 2:1:2 denotes the “long-short-long” feel, where the long notes are twice as long as the short one. We can see that, with every 10 % increase in morph value, we also get a 10 % increase in ratio. This is simply a coincidence as other rhythms can yield different relationships between these two factors.

So, how can we get more insight out of this table than the previous graph? Well, thanks to the numerical ratios, we can tell the n-tuplet feel of each morph value iteration. Let’s try it. The 0 morph is obviously triplets, because 1 + 1 + 1 = 3, and the 1 morph quintuplets; 2 + 1 + 2 = 5. Let’s try with the 0.5 morph: 1.5 + 1 + 1.5 = 4. Interesting, that means that, at 50 % morph, the Gnawa rhythm can be felt in groups of 4. Indeed, by multiplying each ratio member with 4, we get a ratio of 6:4:6, in a 16-note pattern. Let’s take a different morph and try with 0.4: 1.4 + 1 + 1.4 = 3.8. That value is aberrant, as we need an integer number of notes. One way to correct that is to find the least common multiple (LCM) and do the math again. In that case, if you multiply 1.4 and 1 by 5, you get 7. Therefore, the ratio becomes 7:5:7, played in 19-tuplets. Pretty tough to pull off. Let’s try one last time with a value not found on the table: 1/3. We already have 0.3, but that is a poor approximation of one-third, so let’s try with: (1 + 1/3):1:(1 + 1/3). Here, if you multiply all the members by 3, you get a ratio of 4:3:4, and that would be in 11-tuplets. That’s definitely more manageable than 19, as a player!

Once you have a value, you can find its counterparts quite easily, too, if you don’t want to go through the LCM thing again and perhaps find new and interesting things. What’s a counterpart? A counterpart, in this context, is a ratio which shares the same n-tuplet number, but with different note length. Beware, however, to maintain the relationship between the notes. In this Gnawa rhythm, the formula is B:A:B, so the first and last notes must absolutely be the same number. Moreover, it must be greater than the middle one, since it’s a “long-short-long” type rhythm. Let’s take our previous examples and find their counterparts.

I’ll explain a few basic things before moving on with the actual method for finding the values we want. If we choose a value below 0.5, we get a “soft” pattern, not too different from the original one, where all the notes are equal. Anything above 0.5 will be considered a “hard” pattern, as it’s closer to the second conflicting rhythm, with drastically unequal notes. Soft pattern notes have a lesser difference between themselves as do hard pattern ones. One example is between 0 and 1 morph, with ratios of 1:1:1 and 2:1:2 respectively. Now, we can truly go on with the examples.

Remember the 0.5 morph ratio: 6:4:6, in sixteenth notes. Now, its counterparts must also be in sixteenths. We can attribute any value we want here, as long as the sum of the ratio members is 16, and that the B:A:B, “long-short-long” conditions are respected. A quick find is the 7:2:7 ratio, but it doesn’t figure anywhere on our table, not even in our graph. Indeed, the biggest gap between long and short in our graph is a factor of 2, with the 2:1:2, 100 % morph value. In this newfound pattern, the long-short difference is a factor of 3.5! The morph value for this pattern is 157.5 %. I haven’t found a formula that can give me the morph value when fed the note ratios, so I had to manually find the matching morph value. If you find that formula, please let me know! So, 7:2:7 is the hard counterpart to the soft 6:4:6 pattern, just like how 5:2 and 4:3 are two quintuplet swing patterns, but hard and soft respectively.

Above is a similar graph to the previous one, except that its boundaries extend to below and beyond 0 and 100 % morph, up until the point where the rhythm becomes unviable; where one or more note gets a value of 0. For this particular example, the lower boundary is -500 % and the upper one 250 %. Since there is a gap of 1 tick between each note, so that they are adequately played back, the actual limits are actually -499 and 249 %, but there is nothing much to worry about. These are extreme examples that could be useful only in few and very specialized contexts.

As before today, it was impossible to input a value below 0 or above 100 in Marathon. However, as I was writing this I wondered what would happen if I let the program calculate rhythms beyond its boundaries. As it turns out, it works as expected (up until the aforementioned thresholds), so I’ve removed the safeties in version 2019-05-04.

One possibility that this feature brings is the ability to morph between rhythms with a different number of notes. If we follow the previous example, with the Gnawa rhythm, we can program a beat that goes from 0 % morph to 249 %. At the end of this MIDI file, it will almost sound like there are just two notes being played, as the middle one gets shrunk into nothingness. The next step could be to start with a two-note swing rhythm which gradually morphs from equal notes to a smaller and smaller second note, the swung one, while the first one becomes larger and larger and eventually encompasses the whole measure, making the other one disappear in its shadow. If you want more notes, you’d need to reverse the process by, for example, just going backwards and starting with a fully morphed swing pattern where the second notes become larger and larger until the two are of equal length. The hard part, here, is to find the cutoff where one note becomes unviable, since I don’t have a ready formula to find it as of now. But, nonetheless, this brings up new possibilities that ought to be explored.

You need to know a few things before finding out what the limits of a rhythm is. First, the length (in MIDI ticks) of the shortest and longest notes in the phrased rhythm at morph 0 and 100, and, second, the number of notes in your rhythm. Simple, right? The rest can be derived from these values. Let’s once again take example with our Gnawa rhythm. I’ll then try the formula on the swing pattern.

So, for the Gnawa triplet, we have three notes. In the phrased version, there are two notes with the same length, but that doesn’t change how we proceed. The longest note here has a value of 480 ticks at morph 100, and 400 at morph 0, since the three notes of equal length fit inside a $$\frac{5}{16}$$ bar of 1200 ticks. For the shortest note, the middle one, it is 240 ticks long at morph 100 and, once again, 400 at morph 0. With this information we can start calculating. Let’s just put then formally so we can use them more conveniently.

Number of notes: $$n = 3$$

Length of longest note, morph 0: $$L_l^0 = 400$$

Length of longest note, morph 100: $$L_l^{100} = 480$$

Length of shortest note, morph 0: $$L_s^0 = 400$$

Length of shortest note, morph 100: $$L_s^{100} = 240$$

Lower threshold: $$T_l$$

Upper threshold: $$T_u$$

First, we need to find what a change in 1 % morph will do to our tick value. Let’s start with the longest note. For that, we need to subtract: $$L_l^{100} – L_l^0 = 80$$, and divide it by 100 to get the change in 1 %. $$80 / 100 = 0.8$$. So, each percentage of increase in the morph value will increment the note’s tick value of 0.8. Let’s name this variable $$s$$, for step. Then, the penultimate step to find the first of the two limits of this rhythm is to calculate at what point the note’s tick value reaches 0.

In order to do this, we just need to divide $$L_l^0$$ by $$s$$, and invert the equation by multiplying $$-1$$ somewhere in there. Here it is: $$L_l^0 / s \times -1 = T_l$$. And let’s fill in the equation with actual numbers to solve it: $$400 / 0.8 \times -1 = -500$$. Is this a credible result? If you look back at the previous graph on this page, $$-500$$ is indeed one of the two limits of the rhythm!

The only thing left to do with that number is to correct for the spaces that the program leaves between the notes. These spaces have a value of 1 tick, and they’re there just so the notes are played back correctly. Just imagine hitting a note on the piano. If you want to hit the same note again, you’ll need some time to move your finger up so that the key disengages and can be reactivated again. That’s what that space is for. To correct the value, we just need to add or subtract $$n$$ to the threshold. Add if it’s the lower threshold and subtract if it’s the upper one. So: $$T_l^c = -500 + 3 = -497$$. Note: here the $$^c$$ stands for “corrected”.

Repeat everything for the other note, and you’ve got your other threshold.

1. $$(L_s^{100} – L_s^0) / 100 = s$$: $$(240 – 400) / 100 = -1.6$$

2. $$L_s^0 / s \times -1 = T_u$$: $$400 / -1.6 \times -1 = 250$$

3. $$T_u – n = T_u^c$$: $$250 – 3 = 247$$

Voilà! The Gnawa triplet’s thresholds in Marathon are -497 % and 247 % morph. You can now also use this procedure to find the limitations of other rhythms and even those you’ve come up with.

Let’s do the same exercise with one of the swing patterns. Let’s try the two-note dotted quarter note rhythm.

$$n = 2$$

$$L_l^0 = 480$$

$$L_l^{100} = 720$$

$$L_s^0 = 480$$

$$L_s^{100} = 240$$

1. $$(L_l^{100} – L_l^0) / 100 = s$$: $$(720 – 480) / 100 = 2.4$$

2. $$L_l^0 / s \times -1 = T_u$$: $$480 / 2.4 \times -1 = -200$$

3. $$T_l + n = T_l^c$$: $$-200 + 2 = -198$$

4. $$(L_s^{100} – L_s^0) / 100 = s$$: $$(240 – 480) / 100 = -2.4$$

5. $$L_s^0 / s \times -1 = T_u$$: $$480 / -2.4 \times -1 = 200$$

6. $$T_u – n = T_u^c$$: $$200 – 2 = 198$$

Interestingly enough, this swing beat’s thresholds are $$198$$ and $$-198$$ % morph.

So, now that I have a working formula, I’ll try to incorporate it to Marathon. This way, the program could tell you what the boundaries of any rhythm is so you could explore them safely, without fear of running into unexpected results.

During all this article, I’ve focused mainly on easily identifiable, recognizable, and playable ratios. However, the reality is often somewhere between these peaks of simplicity. If you wanted a 19-tuplet 7:5:7 rhythm, you can already just write it using Guitar Pro. What you’re less likely to be able to create using preexisting software is rhythms with higher LCM values—like, for example, a 13:7:13 rhythm in 33-tuplets—or assuredly cannot create, like progressive morphing from one value to another, or, again, from three-note to two- or four-note rhythms. Nonetheless, genuine artists of the Gnawa tradition—and others using microrhythms—have integrated them to a point where it’s hard to imagine for us who grew in a Western musical culture. These musicians seamlessly and naturally flow from one morph value to another, on the spot, and they don’t always—perhaps don’t often—correlate with simple ratios either. I think Marathon is going to be useful as a practice tool to integrate different microrhythms into one’s playing style and musical mind, and, with a little more work on the MIDI files, can become a powerful compositional tool as well. Whether it be for musicians of non-Western tradition to create or recreate their music using current MIDI technology or for Western musicians to better learn and appreciate other cultures, or for anyone to create something new and unprecedented. I hope you enjoy!