Marathon Devlog 1: Presets

[Github Link]

I never thought I’d write a devlog someday. I feel like dishonouring the “developer” title, but for lack of a better word, I’ll use it. I’ve already announced you I began working on a Python program that could give you a MIDI that includes microrhythms. For the uninitiated, think of microrhythms, or xenorhythms, as “beats between the beats” that are practically unwritable in Western music’s notation system. However, these rhythms are quite prevalent in many different musical cultures, such as Gnawa and Brazilian Samba, and even within the fortress of Western music thanks to the Viennese Waltz.

When I wrote that post earlier this week, the program could only take in a MIDI file and interpolate a microrhythm between the two tracks provided in order to spit out a single MIDI track consisting of said microrhythm. Today, however, I’ve decided to add a bunch of presets, mostly taken from Malcolm Braff’s website. The new feature with this version is that you don’t have to feed the program a MIDI file anymore. You still can, if you wish, but you can also use one of the various presets available, which will serve as rhythm templates.

The program also has some user interface now! When you run it, it will show you a list of presets and you must choose one of them.


1: Custom File

This is the same thing as the earlier version. You upload a MIDI file with two tracks, and the program interpolates a rhythm between those two according to the morph value you feed it.

2: Swing and 3: Half-Swing

From here on, you don’t feed the program a file, but command it to create one for you with a few values. Swing and Half-Swing are similar, but the Swing preset hits the swung note in every beat, while the Half-Swing preset leaves one quarter note unfilled with a swung one. The latter is the typical quarter-note followed by the long and short swung notes. I have added a bunch of recommended morph values that you may have seen in this article about uneven notes. The 100% value will give you a 3:1 hard swing beat. I might add another preset later on for harder swing feels (up to 7:1 or 15:1 or more).

4: West African Triplet

Presets 4 to 6 are from various musical traditions around the world. Feel free to try them out and get a feel for them if you don’t know them already.

5: Gnawa Triplet

6: Brazilian 16ths

7: Braff’s Quintuplet

Mr. Braff included a five-note pattern that is colliding with a septuplet feel phrase.

8: Viennese Waltz

The Viennese Waltz usually has a shorter first beat and a longer second beat, while the third beat is of normal length. According to some research, one way to notate it is with a 3:5:4 note duration, but according to other estimates, I suggest a value of around 65% morph to get more human results. I might change this value after feedback of more reading on the subject.

Morph Value

After choosing your preset, you will be asked to enter a morph value. Examples are included for all presets, with the bare minimum showcasing the 0% and 100% values. The Swing presets have the most examples at 7, including the 0% unswung morph value. Here you can enter a decimal number or an integer. The morph value will help calculate where on the spectrum between pattern A and pattern B your microrhythm stands. A value of 0% will always result in a series of even notes, while a value of 100% will give you the fully formed phrase pattern. None of these are microrhythms, but if you enter any other value, you’ll get one!


The code calculates one pattern at a time. It can range from 2 beats for the Half-Swing to a single beat divided into sixteenth notes for the Brazilian 16ths preset and quintuplets for Braff’s Quintuplets. Since all of those are pretty short, I gave the code the ability to repeat the pattern any number of time. If you want to create a practice track, it’s better to put a large value in there. If you only want one pattern, write 1.

Future Stuff

I hope the program will provide some fun and new possibilities for musicians around the world. For now, I will look to add more presets and morph value examples to go with them. For the program as a whole, I will try to make it a standalone that won’t require you to run it with the command window or terminal. I’d greatly appreciate any form of feedback, but the biggest reward would be to hear music that my little code helped create!

On February 27 2019, this entry was posted.
Loading Facebook Comments ...