COS 126

Mozart Minuet Generator
Programming Assignment

Due: Monday, 11:59pm

In 1787, Wolfgang Amadeus Mozart created a dice game (Mozart's Musikalisches Würfelspiel). In the game, you compose a two part waltz by pasting together 32 of 292 pre-composed musical elements at random using a table of rules.

The waltz. The waltz consists of two parts - the minuet and the trio. Each is comprised of 16 measures, which are generated at random according to a fixed set of rules.

Part 1: generating the waltz. For this part, your goal is to generate a random sequence of measures according to the rules described above. Initialize a 13-by-17 array minuet so that minuet[i][j] is the musical element to play in measure j if you roll i. Initialize a 6-by-17 array trio so that trio[i][j] is the musical element to play in measure j+16 if you roll i.

Part 2: playing the waltz. Crude approach: play each measure in turn using StdAudio.play. Not ideal because there is a slight, but annoying, pause between each measure. Instead, concatenate all of the measures together, overlapping each pair of successive ones by a small amount.

Composition. Here is a sample waltz generated from this process and the accompanying musical score. There are 11^16 * 6^16 different possible results, some of which are more likely than others. Since this is over 10^23 different possibilities, each time you play the game you are likely to compose a piece of music that has never been heard before! Mozart carefully constructed the measures to obey a rigid harmonic structure, so each waltz reflects Mozart's distinct style. Unfortunately, due to the rigidly, the process never results in anything truly extraordinary.

This assignment was developed by David Costanzo and Kevin Wayne, inspired by the Mozart's Musikalisches Würfelspiel website.
Copyright © 2004.