Home           About           Downloads





Mechabach


This program demonstrates a simple procedural composition technique for automatically generating contrapuntal compositions. Sounds completely crazy? Try it.

When you run it, it generates a file called "test.mid", and proceeds to open it with the default midi playing program you have installed. I suggest using MAMPlayer, because of its visualisation of the midi file as it plays it.

What is it doing?

It generates several independent tracks, one note at a time. Notes inside beats 1 and 3 are always notes in the tonic chord, and notes inside beats 2 and 4 are always notes in the dominant 7th chord. Since it always works in C major, the tonic notes are C, E and G, and the dominant notes are G, B, D and F. Also the note that is chosen is either the nearest or 2nd nearest higher or lower note to the previous note that is part of the chord it is assigned to. The choice about whether the note is higher or lower, or is the nearest or 2nd nearest is a random choice. For example, if the previous note is C, and the next note falls inside the 2nd beat of the bar, then it may either choose the D or F above the C, or the B or G below the C. As for the rhythm, there are 3 rhythms, each 1 bar long. These are 4 crotchets, 8 quavers, or a hopping rhythm of 4 repeats of a dotted quaver and a semi-quaver. Every bar, it chooses randomly from these 3 rhythms.

Will it ever end?

Download

Download source code

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.