A few months ago I read somewhere that Mozart had written an algorithm to compose music automatically. This, of course, fascinated the shit out of me. I did a bit of googling and turned up the following:

     “Music publishing was a thriving trade during the latter part of the 18th century in Europe. Publishers vied with one another to print the works of the latest “hot” composer. Many of them looked for novel ways to entice new customers into their music shops.”

     “One such ploy was to publish systems that would allow any amateur to compose music without having to know the techniques or rules of composition. The London music publisher Welcker, for example, issued a “Tabular System whereby the Art of Composing Minuets is made so easy that any person, without the least Knowledge of Musick, may compose ten thousand, all different, and in the most pleasing and correct Manner.”

     “Many of these schemes involved using dice or other randomizers to select musical fragments from an array of choices. Composer Johann Philipp Kirnberger (1721–1783), a former pupil of Johann Sebastian Bach (1685–1750), suggested the use of dice for this purpose in his book The Ever-ready Composer of Polonaises and Minuets, published in 1757.”

     “One well-known example of such a scheme is the “Musikalisches Würfelspiel” (Musical Dice Game), first published in 1792 in Berlin. Attributed by the publisher to Wolfgang Amadeus Mozart (1756–1791), it appeared a year after the composer’s death.” [source]

     So it was a dice game, and it might not have been by Mozart at all, but it was a start. The next step was to look into the ‘authenticity’ issue. In doing so, I found several essays that conclude that Mozart was not the author, but that the dice game was a result of the rampant plagirism that plagued the music publishing “scene” of the 1800’s. Chief among the evidence are the tables used in the “Mozart” game, which appear identical to tables used in earlier games by other authors. An essay that meticulously traces the origins of such dice games can be found here. The author finds that many dice games bearing similarly incorrect credits were once available from the same publisher, and manages to find many simlarities between these games and previously published works. He infers from this that the Mozart game has similar origins, and that Mozart’s name was invoked purely for reasons of marketing. The essay concludes:

     “In short there is absolutely no evidence, even a hint beside Mozart’s name being on the title pages of the above issues, that these games had anything to do with Mozart.”

     This does not mean, however, that Mozart did not mix a bit of math with his music. Another article, after establishing that the dice game is most likely not authentic, adds the following:

     “Nonetheless, there are indications that Mozart enjoyed mathematical puzzles. He also had a lively sense of humor and was fond of playing around with names. And he had a passion for gambling—a major preoccupation at the time (along with drink) among the men of both Salzburg and Vienna.

The article goes on to discuss the beginnings of a musical game found in one Mozart manuscript:

     “On both sides of the sheet, Mozart wrote down long strings of measures, grouped into two-bar melodies, each labeled with a letter of the alphabet and a number (1 or 2). However, other than supplying a “worked-out” example at the end of each page, he gave no instructions on how to proceed.”

     Hideo Noguchi of Kobe, Japan, has written a paper on the rules of the game as he has worked them out. It appears to be a method for developing a ‘signiture meolody’ based on one’s name. Noguchi’s paper is available online here, complete with figures depicting bits of the original manuscript.

Gameplay

     Ok dudes, so you want to play the “Not by Mozart” dice game? Itching to compose some minuets? The procedure is as follows: the ‘composer’ rolls two dice and looks up the resultant roll in a table. The table dictates a certain numbered measure of music to be played. This process is repeated 16 times until the randomly generated minuet is complete. In the interest of further alienating former kempa.com readers, I’ve pieced together a short discussion of the mathematics involved in this game from various sources on the internet. It might be a good idea to visit one of these two sites – both are web-based midi implementations of the game – and compose a few minuets before moving on, so you aren’t completely lost.

     The total achieved by throwing a pair of six-sided dice can result in any number from 2 to 12. Therefore, there are 11 possible outcomes. As such, each of the 16 measures in the resultant composition have 11 possible selections associated with them (Depending on which version you’re going by, the 8th and 16th measure have either the standard eleven, or a far less impressive two possibilites). This means that the final piece is composed from a pool of ~ 171 prewritten measures. These measures are arranged in a table corresponding to their placement in the context of the 16 measure piece and the dice roll for that measure. You can view an example of the table that determines the measure to be played, and listen to each measure here.

     The most interesting aspect of this game is that the measures are arranged within the table according to the total rolled on two dice. The probability of getting a certain result when rolling two dice dictates that certain measures will be chosen more often than others based on their positioning. I’ve illustrated this in a ridiculous table, below:

Dice 1

Dice 2

2

3

4

5

6

7

8

9

10

11

12

1

1

x

                   

1

2

 

x

                 

1

3

   

x

               

1

4

     

x

             

1

5

       

x

           

1

6

         

x

         

2

1

 

x

                 

2

2

   

x

               

2

3

     

x

             

2

4

       

x

           

2

5

         

x

         

2

6

           

x

       

3

1

   

x

               

3

2

     

x

             

3

3

       

x

           

3

4

         

x

         

3

5

           

x

       

3

6

             

x

     

4

1

     

x

             

4

2

       

x

           

4

3

         

x

         

4

4

           

x

       

4

5

             

x

     

4

6

               

x

   

5

1

       

x

           

5

2

         

x

         

5

3

           

x

       

5

4

             

x

     

5

5

               

x

   

5

6

                 

x

 

6

1

         

x

         

6

2

           

x

       

6

3

             

x

     

6

4

               

x

   

6

5

                 

x

 

6

6

                   

x

 

Total:

1

2

3

4

5

6

5

4

3

2

1

     As you may or may not be able to see from this hastily constructed table, a roll of two dice is 6 times more likely to produce a total of seven than a total of two or twelve. Because of this, we see that the probability of a measure being chosen is directly dependent on its position in the table. As the tables were composed by the author of the game, the mathematically optimistic among us can assume that the composer took this into account when arranging the measures, placing the measures he favored with the more likely-to-be-rolled totals, and hiding the more exotic and less aurally pleasing meaures along rows two and twelve of the table. For reference, the probability of realizing each total with a roll of two dice is conveniently recorded in the table below:

Dice Roll Probability
2 1/36
3 2/36 = 1/18
4 3/36 = 1/12
5 4/36 = 1/9
6 5/36
7 6/36 = 1/6
8 5/36
9 1/9
10 1/12
11 1/18
12 1/36

     This game has proven a popular project for programmers all over the place, and there are a heap of web-based implementations. Here’s a list of the best working versions I found:

  • This version, by Zsófia Ruttkay and Bram Boskamp, is among the best. While it doesn’t show you any of the randomizing, it does everything else remarkably well: automatically loading the score to the generated piece, playing it in midi, and presenting you with a variety of playback options. There’s another simple MIDI version by John Chuang, here.
  • There’s a simple shockwave version, by Michiko Charley, here. This one also keeps the randomizing behind the scenes, jumping right to the playback of completed random piece. Uniquely, The chart of each measure is displayed as the measure is played, giving a nice visual reference to where each interchangable measure begins and ends for those of us who do not read music.