2018-05-10 Minor update

Many musicians consider that composition is simply out of their reach. They learn to play music, sometimes exceedingly well, but they never consider writing their own compositions.

It shouldn't be so. Think of your ability to read and write. After you've learned to put words on a line, wouldn't you want to start writing letters, emails, blogs, poems or stories? It's the same with music. Once you've learned to read and write music, wouldn't you want to compose some music yourself?

What's more, wouldn't you wish for some help from your computer along the way? How about the musical equivalent of a spell checker, to make sure that you enter a fitting chord for the second voice? Or wouldn't you want a “word completion program” to help you finish a measure in a given style?

Surprisingly, there are very few tools available to help you do any of this in music. Indeed, even fitting a new note of a different size into an existing bar is a fairly daunting task in many of today's notation programmes. Similarly, I haven't seen a system yet that checks the chord quality of a second voice for you, or that makes intelligent suggestions for finishing a musical phrase. (See minor update [1])

Historical Precedents

And yet, this isn't an entirely new problem. “Musical piece completion” of sorts has existed for many years, long before there were any computers.

Around Mozart's time, there was a social game that consisted of constructing a piece of music by determining new sections of the piece with throws of dice. Each new section had to fit organically into the preceding portions of the piece. In fact, “composing” a piece of music in this fashion was a common parlour game for close to a century in the 18th century and well into the 19th century.

The most famous was Mozart's “Musical Dice Game” (German “Musikalisches Würfelspiel“) which we shall illustrate here.

It is not sure that Amadeus Mozart himself was the veritable composer of this game. It is certain that the musical motifs do resemble Mozart's style of writing and that the game uses the same table of rules that Mozart employed. But there exists no manuscript in Mozart's writing that clearly documents his authorship. Also, the tunes are very simple, much more characteristic of Mozart's early compositions than of those he wrote at the end of his life. The game was published by his publisher Nikolaus Simrock in Bonn in 1792, one year after Mozart's passing (K. 294d or K. Anh. C 30.01), so the melodies might have been written either by Mozart or by a clever imitator. Read more about it in the Computer Music Tutorial (Roads, 1996, pp. 8231). The music can be found in the Appendix of Schwanauer & Levitt (1993)2. Machine Models of Music, or can be obtained from ISLIP3. See also Roads, C. (1996). The Computer Music Tutorial.

How to play the parlour game

All the while, the Dice Game is a good illustration of an early form of “composition assistance”. Let's see how it worked.

A group of aristocrats would gather in a hall sufficiently large for dancing. In the case of Mozart's Dice Game, they had prepared a composition consisting of two musical parts. The first part was to accompany a minuet dance and the second a trio dance. Those were common dance sequences destined for several pairs of dancers.

These 18th century dances were commonly called “waltzes”. They involved fairly complex foot work, a turning movement and a soft foot sliding (German “Schleifer”). Given the elegant and smooth movements in wide dresses and sophisticated outfits of the time, these dances were of bewitching elegance, very different from the waltzes that became common at the end of the 19th century (Strauss, etc.). For an illustration of classical minuet dancing, watch this video:

Classical minuet dancing


A trio dance can be seen here:


And a wonderful minuet sequence is also here:


The composition of the musical piece was decided by 32 throws of dice which pointed to 176 possible minuet measures to choose from, as well as to 96 possible trio measures. The result of the dice roll was looked up in a table to determine the next measure to play.

In this way, the game provides an enormous number of possible compositions to accompany the dances. Let's count them up. Two dice are used to determine each of the 16 minuet measures with 11 possibilities for each measure. Then one die is used to determine each of the 16 trio measures where there are six possibilities for each measure. In theory, this would provide 1116 * 616 = 1.3 * 1029 possible compositions, which is a 13 followed by 28 zeroes. The number is actually slightly smaller, since fewer real choices are offered at the beginning and at the end of the composition than is theoretically foreseen, since several initial and final dice choices point to the same sequence.

Once the dice were thrown, the various pieces had to be copied out of the four pages of sheet music onto fresh music sheets, so that they could be performed by a small orchestra, an ensemble or a piano. Of course that was the tedious part of the game which is spared for us, since we now have computers that can do instantaneous “musical look-ups” in close to no time. Indeed, the game has been implemented on computers a number of times in the 1980s and 1990s. Currently it is primarily available as a Java implementation by Andrew Troedson, using the free JMusic framework4. The program is included in the JMusic general download. The examples for our experiment have been generated with Mr. Troedson's implementation.

Is this creative composing?

But is this “real, creative composing”? Some authors have questioned the creativity of such a procedure. They consider this to be nothing but a patchwork procedure with little musical creativity. For example, consider Mr. Troedson's observations about the range of compositions that are possible with this game. He regrets that the strict minuet form of this game does not permit much creative freedom:

“It is also disappointing to realize that, while each generated new work does have its subtle differences, nothing extraordinary or excitingly new will ever be produced. This is mainly because Mozart has composed the phrases to follow a strict harmonic structure that remains unchanged in every new generation. The reason that he has done this is obvious -- it is the easiest way to guarantee that each generation will sound correct (however this does come at the cost of spontaneity).”5

Which raises a question: does all music need to be highly creative?

In my estimation, not always, and probably not in this case. The dancers at the end of the 18th century wished for a pleasant, new and harmonious-sounding tune to dance to that respected the established time structure required for their dance. For them, creativity was only a by-product. In these pieces of music, the main benefit was to be able to obtain to a vast variety of melodies that all respect the clear minuet + trio form.

This brings us back to our need for “musical word completion programmes”. Do we need great creativity every time? Perhaps not. When composing for a specific purpose like dance accompaniment, we may just want the music to sound pleasant to the ear, and for that, a programmed measure completion may just do the trick.

The Experiment

Now let's hear some examples. The original manuscript does not specify a specific instrument for the two-voice melodies, so we shall use a piano that is tuned very much like the ones used in Mozart's time.

According to Scholes6, Mozart used a piano tuned to 421.6 Hz, and for keyboard instruments, he probably used a regular meantone temperament tuning based on an octave divided into 55 equal steps7. Consequently we used a close approximation of this tuning that we found in Pianoteq8 for the J.E. Schmidt 1790 piano simulation, which gave us A = 415 Hz with a 1/5 meantone scale according to Verhejen. This is fairly close to how the Dice Game melodies might have sounded on a piano in Mozart's time.

For comparison, I've also added versions in modern equal-tempered tuning with A = 440 Hz, as performed on Pianoteq's D4 piano. The difference between Mozart's and modern tuning is quite notable.

Here are three passes through the Musical Dice Game. They seem very short, because our implementation of the game does not repeat the minuet part, as specified in the original instructions, and no overall repetition is performed. Instead of the 50 seconds used here for each composition, a complete performance for each piece may well last a full 3-5 minutes.

1a. Mozart Dice Game random pass 1. Mozart tuning

1b. Mozart Dice Game random pass 1. Modern tuning.


2a. Mozart Dice Game random pass 2. Mozart tuning.

2b. Mozart Dice Game random pass 2. Modern tuning.


3a. Mozart Dice Game random pass 3. Mozart tuning.

3b. Mozart Dice Game random pass 3. Modern tuning.



1 Schwanauer, S. & Levitt, D. (1993). Machine Models of Music. The MIT Press.

2 Roads, C. (1996). The Computer Music Tutorial. The MIT Press.

3 http://hz.imslp.info/files/imglnks/usimg/b/bc/IMSLP20432-PMLP47543-mozart_-_dice_waltz.pdf

4 JMusic: http://explodingart.com/jmusic/

5 http://explodingart.com/dib/tutorials/jmtutorial/MozartDiceGame.html

6 Scholes, Percy A. The Oxford Companion to Music. 10th edition. Oxford University Press, 1975. pg. 809 “Pitch: the period of Haydn, Mozart, and Beethoven.”

7 Monzo, J.L. (2001). http://tonalsoft.com/monzo/55edo/55edo.htm

8 https://www.pianoteq.com/


Minor update 2018-05-10

[1] After much searching on Internet and asking around, I have found some updates for "making intelligent suggestions for finishing a musical phrase". There are actually two issues: (1) helping musicians avoid errors and (2) making useful suggestions.

For category (1), my composition teacher tells me that the Sibelius programme has an option for chord checking. This is non-verified, since I don't have a license for Sibelius. I have however successfully used the Counterpointer programme from Ars Nova (http://www.ars-nova.com)  for several months. It implements various levels of the Fux counterpoint rules, and it also lets you define your own level of strictness for chord checking. The developers tell me that a major revamp of the programme is currently underway, with many promised changes to the aging Windows interface.

For category (2), I have found one mature, functional and well thought-out candidate, and that is Harmony Navigator from Cognitone (http://www.cognitone.com/products/nav/intro/page.stml). I have just acquired a license and will study it more in detail in the coming months. This programme is interactive. For each stage of a given composition phrase, it shows you a palette of possible chords and chord progressions. It appears very promising to me, but for best application, it appears to require at least an intermediate level of musicianship.